Authentication
All API calls use a Keystone token in the X-Auth-Token header. Get the token from POST /v3/auth/tokens.
Application credential
Use an application credential for scripts and CI. It is scoped to its project and does not need a TOTP code.
Create one in the Vietnix Enterprise Cloud console, see API credentials.
Sample Request
curl -ksD - -o /dev/null -X POST \
-H 'Content-Type: application/json' \
-d '{
"auth": {
"identity": {
"methods": ["application_credential"],
"application_credential": {
"id": "<credential-id>",
"secret": "<credential-secret>"
}
}
}
}' \
https://api.vietnix.cloud/v3/auth/tokens
POST https://api.vietnix.cloud/v3/auth/tokens
Content-Type: application/json
The response is 201 Created. The token is in the X-Subject-Token header:
HTTP/1.1 201 CREATED
X-Subject-Token: gAAAAA<...>
The credential is already scoped, so no scope block is required.
Password
Password login works for interactive use. If the account enforces 2FA, include a valid TOTP code or use an application credential instead.
Sample Request
curl -ksD - -o /dev/null -H 'Content-Type: application/json' -d '
{
"auth": {
"identity": {
"methods": ["password"],
"password": {
"user": {
"name": "user-1234",
"domain": {
"id": "921940ee9d6c465daa555fcc3e3764a2"
},
"password": "password1234"
}
}
},
"scope": {
"project": {
"name": "project-1234",
"domain": {
"id": "921940ee9d6c465daa555fcc3e3764a2"
}
}
}
}
}' https://api.vietnix.cloud/v3/auth/tokens
Use the token
TOKEN=$(curl -ksD - -o /dev/null -X POST \
-H 'Content-Type: application/json' \
-d @auth.json https://api.vietnix.cloud/v3/auth/tokens \
| awk -F': ' 'tolower($1)=="x-subject-token"{print $2}' | tr -d '\r')
curl -ks -H "X-Auth-Token: $TOKEN" \
https://api.vietnix.cloud:8774/v2.1/servers
Do not commit the credential or the token. The CLI stores the same values in an openrc file or clouds.yaml.