All API end points are protected and you will need a bearer token to send to the end point before you will be permitted access. To obtain a bearer token you will need to send a request to the following end point:
POST
Request
The following form-urlencoded content needs to be sent in the request:
Body
grant_type | client_credentials |
scope | api |
client_id | {API Client ID} |
client_secret | {API Client Secret} |
See How to create API Clients to see how to obtain API Client IDs and secrets
Response
The response will be a JSON object containing the following properties:
access_token | the bearer token to be passed in api requests |
expires_in | the lifetime of the token in seconds |
token_type | the type of token |
C# Example:
var client = new HttpClient(); var request = new HttpRequestMessage(HttpMethod.Post, "https://{platform API url}/idp/connect/token"); var collection = new List<KeyValuePair<string, string>>(); collection.Add(new("grant_type", "client_credentials")); collection.Add(new("scope", "api")); collection.Add(new("client_id", "{API Client ID}")); collection.Add(new("client_secret", "{API Client Secret}")); var content = new FormUrlEncodedContent(collection); request.Content = content; var response = await client.SendAsync(request); response.EnsureSuccessStatusCode(); Console.WriteLine(await response.Content.ReadAsStringAsync());
cURL Example
curl --location 'https://{platform API url}/idp/connect/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=client_credentials' \ --data-urlencode 'scope=api' \ --data-urlencode 'client_id='{API Client ID}' \ --data-urlencode 'client_secret='{API Client Secret}'