Socialid.datastore.getObjects
From Social ID Developers
Revision as of 16:06, 20 March 2017 by Renato.neves (Talk | contribs)
Contents |
Description
API to get datastore objects from the user logged in the current login session.
Usage
socialid.datastore.getObjects(schemaName, handler)
Parameters
schemaName | required | name of the datastore schema. | handler | optional | callback function to handle the API response. |
---|
API Response
data | Javascript object containing an array of objects containing the data stored for the given schema name from the user logged in (see description below). | status | The API response status. Can be success, if there is an user logged in the current login session and its data was successfully retrieved, or not_found, if there is no user logged in the current login session. |
---|
Response Data
The data object is an array where each element's properties are at least:
created_at | object created date time. |
---|---|
updated_at | object last updated date time. |
object_id | object id. |
user_id | user id. |
More properties depends on the configuration on the datastore schema definition.
Example
Get basic information about the user logged in the current login session:
socialid.login.init(1); var handler = function(response) { if (response.status == "success") { alert("Datastore objects information: " + JSON.stringify(response.data)); } else { alert("Could not get datastore objects from the current logged in user."); } } socialid.datastore.getObjects('user_data', handler);
Example of "data" object:
data = [{ created_at: "2015-12-16T12:03:12+00:00", updated_at: "2015-12-16T12:03:12+00:00", object_id: "1231530003cd0bb82e789001", user_id: 632 }, { created_at: "2015-13-15T12:09:33+00:00", updated_at: "2015-13-15T12:09:33+00:00", object_id: "100987e28bb0dc3000351321", user_id: 632 }]