Issue
When trying to access the API, through the steps provided here: Access the APIs, all queries are failing and returning an unauthorized response.
Cause
The Authorization or API Key used in the query are incorrect.
Resolution
There's two common reasons for this to occur:
- The Service Key used to generate the Authorization is incorrect. The Service Key found under Organization Settings -> API is actually specific to your Contrast Agents. To use the API, please be sure to use the Service Key found by clicking on your name in the top right of the Contrast UI and navigating to Your Account -> Profile. The keys can be found at the bottom of the page.
- If you're generating the Authorization on the command line using echo, you'll need to ensure that the -n option is used. This prevents a new line character from being encoded at the end of the String. Your command should look like this:
echo -n 'username:service_key' | openssl base64