PUT /account/identity/{identity_id}/token/{service}

Update the assigned token, or assign a new 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 PUT request sent to:

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

If the identity already has a token assigned for the service, a successful call to the endpoint will result in a 200 OK status code.

If the identity does not have a token assigned for the service, a successful call to the endpoint will result in a 201 Created status code.

Parameters

Parameter Description
token
required

The service that the token will used with.

Examples

  1. Update token f657f4cd42852e62c888842b0341bfb3:

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

    The JSON output looks like this:

    HTTP/1.1 200 OK
      Content-type: application/json
    
      {
          "service": "facebook",
          "token": "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 The token 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 200 OK

The token was updated successfully:

{
    "service": "<eg. facebook>",
    "token": "<token>",
    "created_at": <timestamp>,
    "updated_at": <timestamp>,
    "expires_at": <timestamp>
}
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

Occurs if you use an identity_id that does not already exist.

{
    "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: 5

Requires authentication: Yes

Response formats: JSON, JSONP