My API Subscription is approved! How do I call an API?
After you’ve received your credentials from the support team, you may call the API through the Try-it functionality or your favorite API testing tool (i.e. Postman, SoapUI, Advanced Rest Client, etc). But first, you will need to exchange your credentials for an access token. The access token verifies that your application is authorized to access the requested resource.
The Digital Marketplace uses OAUTH 2.0 for security. This article shows how to exchange client credentials for an access token. Before starting, please make sure you have your support email available containing your client ID and secret.
Exchanging Client Credentials for a Token (used for Basic Daily and ISO API)
The authorization, token and refresh URLs referenced in the examples may also be found in the Open API specifications available to download from the Marketplace API Explorer.
Exchanging your Client ID and Secret for a Token Using cURL:
Using your PC command line utility or Mac Terminal, follow the steps below:
Step 1: Obtain your token
curl --request POST 'https://fedlogin.cat.com/as/token.oauth2' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'client_id={{YOUR_CLIENT_ID}}' \
--data-urlencode 'client_secret={{YOUR_CLIENT_SECRET}}'
Step 2: Use your token to call an API using the following format:
curl --request GET 'https://services.cat.com/apiProduct/v1/endPoint' \
--header 'Authorization: Bearer {{YOUR_ACCESS_TOKEN}}'
Exchanging your Client ID and Secret for a Token Using Postman:
Open Postman and click on the Authorization tab and enter the following settings:
-
Grant Type: Client Credentials
-
Access Token URL: https://fedlogin.cat.com/as/token.oauth2?pfidpadapterid=OAuthAdapterCCDS
-
Client ID: From support email
-
Client Secret: From support email
Then click on the “Get new Access Token” button. Postman will retrieve an access token that can be saved for accessing this API.