Socialid.datastore.getObjects

From Social ID Developers
(Difference between revisions)
Jump to: navigation, search
m (API Response)
m (API Response)
 
Line 26: Line 26:
 
|+
 
|+
 
! align="left" width="200px" | status
 
! align="left" width="200px" | 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, '''not_found''', if there is no user logged in the current login session and '''forbidden''', if the schema is read protected..
+
| The API response status. Can be '''success''' if there is an user logged in the current login session and its data was successfully retrieved, '''not_found''' if there is no user logged in the current login session, or '''forbidden''' if the schema is read protected.
 
|}
 
|}
  

Latest revision as of 20:01, 17 September 2019

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, not_found if there is no user logged in the current login session, or forbidden if the schema is read protected.

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
 }]
Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox