Authentication
🚫
Standard Sim Management Portal Users CANNOT be used to access the API
The Authentication API
is an implementation of the OAuth 2.0 standard which enables API clients to obtain a security token against a client_id
/ client_secret
, which will grant them access to other APIs.
If you have not yet been given a client_id
and client_secret
you can request an API account from your Account Manager.
To discover more about OAuth2 please refer to this site (opens in a new tab).
Request
Your credentials (client_id
and client_secret
) must be provided using a standard HTTP form.
curl --location 'https://auth.cellhire.com/connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=[client_id]]' \
--data-urlencode 'client_secret=[client_secret]]' \
--data-urlencode 'grant_type=client_credentials'
Response
Successful Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"access_token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjRBMDlENTFBMDhEOEUxMTU0OTkyODFDN...",
"expires_in": 3600,
"token_type": "Bearer",
"scope": "simmanage.api.public"
}
Unsuccessful Response
HTTP/1.1 400 Bad Request
Content-Type: application/json;charset=UTF-8
{
"error": "invalid_client"
}
Use token to access API
Once you have the token, you may then use this when calling the API. For example, let’s take a very simple get request to get a list of companies to which you have access.
Example Request
curl --location 'https://api.cellhire.com/api/company' \
--header 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsImtpZCI6IjRBMDlENTFBMDhEOEUxMTU0OTkyODFDN...' \
--header 'Content-Type: application/json'
Successful Response
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
"result": [
{
"id": 123456,
"name": "My Company"
}
],
"totalCount": 1,
"count": 1
}