POST /account/identity/{identity_id}/token

Assign a token for a service to an identity.

To learn how to use the endpoints together take a look at our account API step-by-step page

An HTTPS POST request sent to:

https://api.datasift.com/v1.3/account/identity/{identity_id}/token

A successful call to this endpoint returns: 200 OK plus a JSON object.

Parameters

Parameter Description
service
required

The service you want to use the token with.

Example value: facebook

token
required

The token that you received from that service.

With Facebook, a token consists of a Facebook App Id followed by a pipe followed by a Facebook Client Token.

Example value: 1578488822415834|f657f4cd42852e62c888842b0341bfb3

Examples

  1. Create a new Facebook token in DataSift. When you're using Facebook, a token consists of a Facebook App Id followed by a pipe followed by a Facebook Client Token. In this example, the App Id is 1578488822415834 and the Client Token is f657f4cd42852e62c888842b0341bfb3.

curl -X POST https://api.datasift.com/v1.3/account/identity/1234567890abcdef1234567890abcdef/token 
    -d '{"service": "facebook","token": "1578488822415834|f657f4cd42852e62c888842b0341bfb3"}' 
    -H 'Content-type: application/json' 
    -H 'Authorization: username:api_key'

The output looks like this:

HTTP/1.1 200 OK
Content-type: application/json

{
    "service": "facebook",
    "token": "1578488822415834|f657f4cd42852e62c888842b0341bfb3",
    "created_at": <timestamp>,
    "updated_at": <timestamp>,
    "expires_at": <timestamp>
}

Output Fields

Property Type Description
service string A PYLON service; for example: Facebook
token string A valid token for the service you specified.
created_at int Unix timestamp.
updated_at int Unix timestamp.
expires_at int Unix timestamp. Can be null.

Responses

Response code Description
Status 201 Created

The token was assigned to the identity:

{
    "service": "<eg. facebook>",
    "token": "<token>",
    "created_at": <timestamp>,
    "updated_at": <timestamp>,
    "expires_at": <timestamp>
}
Status 404 Not Found
{
    "error": "An Identity with the supplied id was not found"
}
Status 410 Gone

Occurs if the identity has been deleted.

{
    "error": "The Identity with the supplied id has been deleted"
}

Notes

  1. All calls to the API must be properly authenticated with a DataSift username and API key.
  2. All calls to the API must be versioned. The current version is v1.3.
  3. All POST and PUT requests require Content-type: application/json.
  4. The Account API only accepts valid tokens which have been approved by the data source (Facebook, ...).

Resource information

Rate limit cost: 25

Requires authentication: Yes

Response formats: JSON, JSONP