API Connect

 View Only

using the API Connect REST APIs for CI/CD, how to get a Bearer token for API Connect on AWS

By Tom van Oppens posted Fri September 29, 2023 05:47 AM


In order to use the REST APIs as documented here https://apic-api.apiconnect.ibmcloud.com/v10/ you need to obtain a Bearer token, for API Connect on AWS this works slightly different.

First we need to collect some prereqs

  • a clientid and secret
  • an api_key

To get the client id and secret, got to the hompage of your apiconnect and click on "download toolkit"

this will opens a window where we have the option to download toolkit credentials

In this JSON you'll find the client_id and client_secret we need 

The second phase is to obtain an api_key, back on the homepage of your apiconnect instance and click on your user icon in the left top corner, from there click on "My API Keys"

in the window that will now open click on "add" this will generate a new key.
Now with all this information we can get a bearer token with a rest call that looks like this 

( the URL is dependent on the region of your instance https://www.ibm.com/docs/en/api-connect/saas?topic=information-api-connect-rest-apis )

curl --request POST \
  --url https://api-manager.us-east-a.apiconnect.automation.ibm.com/api/token \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{

This call can be used to get the Bearer token, from there you can use the REST APIs as normal (and documented), to figure out what REST calls to use I usually go through the journey in the UI and look with web developer tools at the rest calls, their URL structure is different but very similar and the body is the same (although often you can format it differently as well)