NoseRub 0.5.4 comes with the first small portion of an API for NoseRub.
General and Authentification
Right now, the API only returns JSON. Authentification takes place through an API key that is passed along with the username in the URL to make an API call. If the authentication did not work out (or you did not activate the API key), you will get a 404 error as result.
Every API call starts like this:
http://identoo.com/api/USERNAME/API_HASH/json/
So, when in the following sections, you see a command, you just have to append it to the URL schema above. Example:
http://identoo.com/api/USERNAME/API_HASH/json/locations/
Return values
Everytime you call the API, you will get a return code, a return message and, in some cases, a dataset. The structure is always the same:
{
"data" : [],
"code" : 0,
"msg" : "ok"
}
In this case here, no dataset was returned. When the code is 0, the API call was successfull. When an error occured, the code will always be nagative, Right now, there is only one error message:
-1 : dataset not found
This is returned, when you try to access a dataset, which could not be found, or to which you have no access to.
Location
This methods can be used to set your current location and get the locations you previously added. Right now, there is no method here, to add, edit or delete locations through the API.
locations
Returns an array with id and name of the locations you previously added through the webinterface. Example:
{
"data" : [
{
"Location" : {
"id" : "1",
"name" : "Home"
}
}
],
"code" : 0,
"msg" : "ok"
}
locations/set/LOCATION_ID
By specifying the LOCATION_ID, your social stream at your NoseRub profile will show, that you currently are at this location.
The result will look like this:
{
"data" : [],
"code" : 0,
"msg": " ok"
}
If you specified a non-existing location id, or one that does not belong to you, you will get this error message:
{
"data" : [],
"code" : -1,
"msg" : "dataset not found"
}