User Cloud Storage API \ Synchronize a user PHP SDK
User Cloud Storage API Resources
| 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 a PUT request with the following POST data to the endpoint /storage/users/user/synchronize.json to
synchronize the user data in your OneAll cloud storage with the user profile stored in your own database.
This endpoint will either update the corresponding user or create a new user record on the fly.
POST data to include in your request
{
"request": {
"synchronize": {
"identifier": {
"field": "#field#",
"value": "#value#"
}
"user": {
"externalid": "#externalid#",
"login": "#login#",
"password": "#password#",
"identity" : {
...
}
}
}
}
}
| Key | Description |
|---|---|
| Unique identifier | |
| If the API finds a user record based on the field/value combination, then that record will be updated. If no match can be found, then a new user record is created on the fly. | |
| * #field# |
Denotes the field that uniquely identifies the user. Possible values are user_token, externalid and login.Example: externalid |
| * #value# |
Denotes the value of the field that uniquely identifies the user. Example: 100000001 |
| User Data | |
| #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 200 (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"
}
}
}
}
}
}