Use cURL with the BLAM API

< All Topics

Basic Authentication

A BLAM API JWT bearer token can be generated using basic authentication by passing in a valid username and password to the –user argument. To use the token in subsequent requests, the response can be piped into jq, a JSON parsing CLI tool, and the bearer token extracted into a terminal environment variable called TOKEN.

TOKEN=$(curl --user username:password | jq -r '.bearerToken')

The ${TOKEN} variable can then be used in subsequent calls to the BLAM API by passing in the token to the Authorization header.

curl -H "Authorization: Bearer ${TOKEN}"

The JWT bearer token can be updated by re-executing the first cURL command as required.