Last active
August 29, 2015 14:25
-
-
Save MariuszWisniewski/b12ca4a5de5d7610baac to your computer and use it in GitHub Desktop.
Get one object from Syncano (v3)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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