User Cloud Storage API \ Update an existing user PHP SDK

Resource/URI GET POST PUT DELETE
Create a new user. /storage/users.json Create
User
Update an existing user. /storage/users/<user_token>.json Update
User
Synchronize a new or existing user. /storage/users/user/synchronize.json Synchronize
User
Authenticate an existing user. /storage/users/user/lookup.json Authenticate
User

Workflow

Request: the code to send to the API

Send an API request to the following endpoint in order to update a user in your OneAll cloud-storage database:

PUT /storage/<user_token>.json

The user's cloud-storage data is kept in a distinct identity. Each user has at least one but may have multiple identities whereby each identity is corresponding to data originating from a different source.


A user record might per example have an identity with data retrieved when the user logged in with Twitter, another one with data retrieved when the user linked his Facebook account and a third one with the custom data that you have saved in the cloud storage.

The cloud storage identity itself is unique per user. If the user that you are updating has no such identity yet, then it will be added. It the user already has such an identity, then it will be updated.

POST data to include in your request

	{
	  "request": {
	    "update_mode": "#update_mode#",
	    "user": {
	      "externalid": "#externalid#",
	      "login": "#login#",
	      "password": "#password#",
	      "identity" : {
	        "name":{
	          "givenName": "#givenName#",
	          "familyName": "#givenName#"
	        },
	        "gender": "#gender#"
	      }
	    }
	  }
	}
Key Description
#update_mode#
string, predefined
Use this property to select how the properties should be updated.

replace (default)
  • Properties that are not specified in the request are ignored.
  • Properties that are specified with null/blank values are removed.
  • Single value properties are updated to the values specified in the request.
  • For object lists the specified elements replace the existing elements.
append
  • Properties that are not specified in the request are ignored.
  • Properties that are specified with null/blank values are ignored.
  • Single value properties are updated to the values specified in the request.
  • Existing values are replaced, if the new values have a different data structure.
  • For object lists the specified elements are added after the existing elements.
#externalid#
string
Your own user identifier. It must be unique amongst all stored users.
Only specify this property if you want to update it.
Example: extid1
#login#
string
The user's login. It must to be unique amongst all stored users.
Only specify this property if you want to update it.
Example: john.doe
#password#
string
The user's password. We apply a one-way hashing algorithm to all stored passwords.
Only specify this property if you want to update it.
Example: 12345678
identity \ *
json
All additional user information is stored in a storage identity attached to the user node.
Please refer to the following page for a complete list of possible values for the identity node.

Result: the code returned by the API

The API returns either HTTP status code 202 (identity updated) or 201 (identity created), indicating a successful request, or another status code, indicating an error in the request.

Example Resultset

	{
	  "response": {
	    "request": {
	      "date": "Thu, 29 Oct 2015 16:11:58  0100",
	      "resource": "/storage/users/2eaf5d01-8244-44b9-878d-9e83073c45e0.json",
	      "status": {
	        "flag": "success",
	        "code": 200,
	        "info": "Your request has been processed successfully"
	      }
	    },
	    "result": {
	      "data": {
	        "user": {
	          "user_token": "2eaf5d01-8244-44b9-878d-9e83073c45e0",
	          "externalid": 1,
	          "login": "john@.doe@example.com",      
	          "date_creation": "Thu, 29 Oct 2015 16:11:57  0100",
	          "date_last_update": "Thu, 29 Oct 2015 16:11:57  0100",
	          "num_logins": 0,
	          "identity": {
	            "identity_token": "99859d8c-6422-4c47-8b5b-40928e36dbea",
	            "date_creation": "Thu, 29 Oct 2015 16:11:57  0100",
	            "date_last_update": "Thu, 29 Oct 2015 16:11:57  0100",
	            "provider": "storage",
	            "source":{
	              "name": "Cloud Storage",
	              "key": "storage"
	            },
	            "id": "/external/1",
	            "gender": "male"
	          }          
	        }
	      }
	    }
	  }
	}

Account Mapping

This endpoint can also be used to store your own user identifiers for users that have logged in with a social network. This will allow you to recognize the users on subsequent logins with the same social network.

After a user has logged in with our Social Login service you first use the received social network profile data to create a new user record in your database. Then you make a call to this endpoint to set the externalid to the user id from your own database.

POST data example

	{
	  "request":{
	    "user":{
	      "externalid": "123456"
	    }
	  }
	}

On subsequent logins with the same social network profile the externalid will be included in the resultset allowing you to recognize the user.

User Contributed Notes