Create subscriber token
This POST
request creates a token for a subscriber. This should happen once it is determined that a subscriber is roaming. The token is received in the JSON response and can then be appended to the end of the URL for a subscriber so that the subscriber can avail of plan purchases.
POST /token
+ JSON request payload
HEADER INFO
authorisation: HTTP Basic Auth
content-type: application/JSON
accept: application/JSON
By default, accept is XML . You must explicitly set accept in your header to application/JSON to receive a JSON response.
|
JSON request payload
With each token creation, a JSON request is sent containing the grant_type
(client credentials) and client_id
which is the msisdn
of the intended subscriber.
Check out OAuth’s page on client credentials for more details. |
{
"grant_type" : "client_credentials",
"client_id" : "<msisdn>"
}
JSON response
There are three possible responses included a successfully-created token, a bad request, and an invalid grant type. An example of each response is shown here.
status 201
{
"access_token" : "<tokenString>",
"token_type" : "bearer",
"expires_in" : 3600
}
status 400
{
"error": "invalid_request",
"error_description": "[client_id cannot be null, grant_type cannot be null]"
}
status 400
{
"error": "unsupported_grant_type",
"error_description": "The grant_type is invalid"
}
HTTP response codes
This API operation adheres to standard HTTP response codes.
-
201
= token created -
400
= bad request