Accessing the Hyperscale Compliance API
To access the Hyperscale Compliance API, open a web browser and type the following in the address bar: https://<hyperscale-compliance-host-address>/hyperscale-compliance
. Before navigating to the address, replace <hyperscale-compliance-host-address>
(remove the angle brackets too) with the IP address of the Hyperscale Compliance Orchestrator VM.
Here is a sample command for Linux to retrieve the IP address.
kubectl describe service proxy -n hyperscale-services |grep "IP:" | tr -s " " | cut -d " " -f 2
Authentication
To authenticate with the Hyperscale Compliance Orchestrator, you must use an API key. This is done by including the key in the HTTP authorization request header with the type apk
.
An example cURL command with the API key would appear as:
curl --header 'Authorization: apk 1.t8YTjLyPiMatdtnhAw9RD0gRVZr2hFsrfikp3YxVl8URdB9zuaVHcMuhXkLd1TLj'
As described in the HTTP Authorization request header documentation, this is the typical syntax for the authorization header – Authorization: <auth-scheme> <authorisation-parameters>
.
For Basic Authentication, include the following header parameters –
Authorization: Basic <credentials>
.For the Bearer Authentication scheme, use the following –
Authorization: Bearer <JWT Bearer Token>
.
Creating an API key
An API key is a simple encrypted string that you can use when calling Hyperscale Compliance APIs.
You must use the initial created API key to create a new secure key. This is done by creating a new API Client entity. The
"name"
attribute must be the desired name to uniquely identify the user of this key.The API key created will never expire.
It is recommended that you regularly rotate API key (by deleting the old one and creating a new one)
For more information on the initial created API key, refer to step 7 in these installation instructions.
Run the following command to create a new API key.
curl -X 'POST' \
'https://<host-name>/api/<api_version>/api-keys' \
-H 'accept: application/json' \
-H 'Authorization: apk 1.t8YTjLyPiMatdtnhAw9RD0gRVZr2hFsrfikp3YxVl8URdB9zuaVHcMuhXkLd1TLj' \
-H 'Content-Type: application/json' \
-d '{
"name": "<name-of-key>"
}'
A response message similar to the one shown below should appear. Copy or save the newly created token from the response, this token value will not be accessible later.
{
"api_key_id": 2,
"token": "2.ExZtmf6EN1xvFMsXpXlOyhHVYlTuFzCm2yGhpUOQQ5ID8N8oGz79d4yn8ZsPhF46"
}
Now that a new and secure API key has been created, the old one must be deleted for security purposes. Run the following command to delete the old key.
curl -X 'DELETE' \
'https://<host-name>/api/<api_version>/api-keys/1' \
-H 'accept: */*' \
-H 'Authorization: apk 2.ExZtmf6EN1xvFMsXpXlOyhHVYlTuFzCm2yGhpUOQQ5ID8N8oGz79d4yn8ZsPhF46'
Using the newly generated key
After you delete the old key, revert the changes performed in step 4 of the Hyperscale Compliance Installation and restart docker-compose. You must be able to use the new key for authorization as follows:
curl --header 'Authorization: apk 2.ExZtmf6EN1xvFMsXpXlOyhHVYlTuFzCm2yGhpUOQQ5ID8N8oGz79d4yn8ZsPhF46'
Default API Version
If the version is omitted from the base path of the request's URL, a default API version i.e. the latest API version of that Hyperscale Engine is used.