Token Authentication
The token obtained in the first step does not have an expiration time and can be used indefinitely, so you only need to obtain the token once for a series of operations
The CloudTower API makes authentication by passing the Authorization field in the headers. Here is how to get a token, using cURL as an example:Except for login, all the requests need to add the authentication field.
curl -X 'POST' \
'http://CLOUDTOWER_IP/v2/api/login' \
-H 'accept: application/json' \
-H 'content-language: en-US' \
-H 'Content-Type: application/json' \
-d '{
"username": "string",
"source": "LOCAL",
"password": "string"
}'
And here is what can be obtained:
{
"task_id": "string",
"data": {
"token": "string"
}
}
The data.token is the authentication field to be used, you can just add it to header.Authorization.
- If called via cURL, add
-H 'Authorization: token-string'. - If called via the swagger api documentation page, click the
Authorizationbutton and adddata.tokentovalue.