In this Article

Using Credentials to Access an API

APIs
ISO 15143-3 (AEMP 2.0) API
Using Credentials to Access an API

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:

Image 1

Then click on the “Get new Access Token” button.  Postman will retrieve an access token that can be saved for accessing this API. 

Image 2

Click "proceed" and Postman will display a dialog box with your token information.  Click the "Use token" to copy the access token to the clipboard. 

Using this token with Try-it on the Digital Marketplace

You may return to the Digital Marketplace to use this token with the "Try-it" functionality of the Marketplace API Explorer.  Navigate to the API you'd like to try, click on the "Authorize" button, and paste your authorization token from the steps above.

Click "Authorize" and then expand the endpoint on the API you wish to test and click "Try it out".  Depending on the endpoint selected, you will see several new fields and buttons to add parameters to your request.  When you have set these values, click the "Execute" button to return results in the window below.

Image 3

If you prefer advanced API testing capabilities consider using an advanced tool like those referenced at the beginning of this help article.

Related Articles

Art05065Art05065Modified

testtest modifiedArt05065

Art05064

test

Art05064

test

/apis/products/qa/cat-qr