Skip to content

Instantly share code, notes, and snippets.

@MariuszWisniewski
Last active August 29, 2015 14:25
Show Gist options
  • Save MariuszWisniewski/b12ca4a5de5d7610baac to your computer and use it in GitHub Desktop.
Save MariuszWisniewski/b12ca4a5de5d7610baac to your computer and use it in GitHub Desktop.
Get one object from Syncano (v3)
function GetOne(DATA_ID) {
var callback = {};
callback.success = function(data) {
console.log('Get one with ID ' + DATA_ID + ' titled: ' + data.title);
};
callback.error = function(data) {
console.log('Get One Fail! - ' + data);
console.log(data);
};
syncano.Data.getOne(PROJECT_ID, COLLECTION_ID, DATA_ID, callback);
}
var authData = {
api_key: "API_KEY",
instance: "YOUR_INSTANCE"
};
var PROJECT_ID = 1234;
var COLLECTION_ID = 1234;
syncano.connect(authData, function(auth) {
console.log("Connected");
GetOne(1234); //not existing object ID - will use error callback if object not found
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment