User Cloud Storage API \ Update User Data PHP SDK

Send a PUT request to this endpoint to update the data of a user in your cloud-storage database.

Resource/URI Cloud Storage Required GET POST PUT DELETE
Users /storage/users.json Create
User
User /storage/users/<user_token>.json Update
User Data
User Lookup /storage/users/user/lookup.json User
Lookup

Workflow

Request: the code to send to the API

Send a PUT request with the following POST data to the endpoint /storage/<user_token>.json to update the data of a user in your OneAll cloud-storage database.

The user data is regrouped in what we call an identity. Each user has at least one but may have multiple identities. Each identity regroups user data coming from a different data source.

A user might have one identity with the data retrieved when he logged in with Twitter, a second one when he linked his Facebook account and a third one with the custom data that you have saved for him.

When you work with the cloud storage, the user data is always kept in it's own identity. It's unique per user and it always has the property provider: storage. If the user that you are trying to update has no such identity yet, then it will automatically be added.

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# 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# 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# 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# 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 \ * 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