User Cloud Storage API \ Authenticate a 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 a POST request with the following data to the endpoint /storage/users/user/lookup.json to retrieve a single user entry based on a user_token, externalid and/or credentials. This endpoint can be used to validate the credentials of a user that authenticates on your website or app.

POST data to include in your request

{
    "request": {
        "user": {
            "user_token": "#user_token#",
            "externalid": "#externalid#",
            "login": "#login#",
            "password": "#password#"
        }
    }
}
Key Description
#user_token# A OneAll user_token.
#externalid# Your own user identifier.
#login# The user's login.
#password# The user's password.

At least one of the lookup field must be specified. If multiple fields are specified, then only the user record that matches all given fields is returned.

Result: the code returned by the API

The API returns either a HTTP status code 200, indicating a successful request, or another status code in case of an error.

Example Resultset Lookup Successfull

  {
    "response": {
      "request": {
        "date": "Thu, 30 Oct 2015 11:11:58  0100",
        "resource": "/storage/users/user/lookup.json",
        "status": {
          "flag": "success",
          "code": 200,
          "info": "Your request has been processed successfully"
        }
      },
      "result": {
        "data": {
          "user": {
            "user_token": "2eaf5d01-8244-44b9-878d-9e83073c45e0",
            "externalid": 1000154211,
            "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": 12,
            "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/1000154211",
              "gender": "male"
            }          
          }
        }
      }
    }
  }
  

Example Resultset Lookup Failed

{
	"response": {
		"request": {
			"date": "Wed, 04 Nov 2015 16:08:23  0100",
			"resource": "/storage/users/user/lookup.json",
			"status": {
				"flag": "error",
				"code": 404,
				"info": "No user corresponding to your lookup criteria has been found"
			}
		}
	}
}

User Contributed Notes