Every datasource defined in CloudIO Platform are exposed as REST web service out-of-the-box. These REST APIs (Web Services) can be used by 3rd party systems to build interfaces/integrations. Below is the flow for establishing hand-shake with CloudIO APIs.

/api/signin - Authenticates the user and returns a sessionId that should be used in all subsequent calls

/api/DataSourceName - Fetch Data

/api/DataSourceName/insert - To insert one or more rows

/api/DataSourceName/update - To update one or more rows

/api/DataSourceName/delete - To delete one or more rows

/api/validateSession - To validates an already established sessionId

Sample code using JQuery to invoke CloudIO APIs are shown below:

Sign In API

var url = 'https://app.example.com/api/';

var request = $.ajax({ url: url + "signin", type: "POST", contentType: "application/json", data: JSON.stringify({ username: 'user', password: 'pwd' }), dataType: "json" }) .done(function(data) { if (data._error === 'Y') { // sign-in failed showError(data.errorMessage); } else { // store the sessionId for later use sessionId = data.sessionId; } });

Session Validation API

var request = $.ajax({
	url: url + "validateSession",
	type: "POST",
	contentType: "application/json",
	data: JSON.stringify({
		sessionId: sessionId
	}),
	dataType: "json"
})
	.done(function(data) {
		if (ifSuccess(data)) {
			if (data.valid === 'Y') {
				// session valid
			} else {
				// Session Timeout
				sessionId = null;
				showError("Invalid Session... try again...");
			}
		}
	});

Data Fetch API

  	var payload = {
 		"sessionId": sessionId,
 		"offset": 0,
 		"limit": 20,
 		"data": {},
 		"orderBy": "#someAttribute# asc",
 		"params": {
 			"executeCountSql": "N"
 		}
 	};
 	var request = $.ajax({
 		url: url + "DataSource",
 		type: "POST",
 		contentType: "application/json",
 		data: JSON.stringify(payload),
 		dataType: "json"
 	});
 	request.done(function(returnJson) {
 		if (returnJson._error === 'Y') {
 			showError(returnJson.errorMessage);
 		} else {
 			// result returnJson.data
 			// returned (returnJson.totalLength - returnJson.offset) rows
 			//  in returnJson.elapsed ms...
 		}
 	});

Location

101 California Street, Suite 2710
San Francisco, CA 94111


440 N. Wolfe Rd.
Sunnyvale, CA 94085


Office 11, 5th Floor, Building 9,
Mindspace IT Park
Hyderabad 500081

p: +1 (844) AT CloudIO (844-282-5683)
f: +1 (650) 300-5247 | e: sales@cloudio.io
© 2009, 2017 CloudIO Inc. | Terms of Use | Privacy Policy