Authentication
The client needs to authenticate using the API Token to get a bearer token for the API calls.
Method and URL
POST /api/v1/auth
Parameters
Parameter | Parameter Type | Description | Required |
---|---|---|---|
apiKey | String | This is the API token required for client authentication. | Mandatory |
Example Request
note
This API does not need Authorization: bearer token
.
POST /api/v1/auth
curl --location --globoff '{{host}}/api/v1/auth' \
--data '{
"apiKey": "apiKey"
}'
Example Responses
Response: Success
{
"statusCode": 200,
"status": "OK",
"message": "Success",
"data": {
"token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IlNTYWZkejFDOE12VnZmZi1TeU9iUkZBVUtQcjhLcjdZaVFkSlRUd1BZM0UifQ.eyJhdWQiOlsiaHR0cHM6Ly9rdWJlcm5ldGVzLmRlZmF1bHQuc3ZjLmNsdXN0ZXIubG9jYWwiXSwiZXhwIjoxNzI5NDU0ODg5LCJpYXQiOjE3Mjk0NTM5ODksImlzcyI6Imh0dHBzOi8va3ViZXJuZXRlcy5kZWZhdWx0LnN2Yy5jbHVzdGVyLmxvY2FsIiwia3ViZXJuZXRlcy5pbyI6eyJuYW1lc3BhY2UiOiJkZWZhdWx0Iiwic2VydmljZWFjY291bnQiOnsibmFtZSI6Imt1YmVzbGljZS1yYmFjLXJvLXNsaWNlLWJsdWUiLCJ1aWQiOiIyMDdmMzllOC0yMjUwLTQ3NTUtOGY2MC01ZWM1YzZjNzM3YjIifX0sIm5iZiI6MTcyOTQ1Mzk4OSwic3ViIjoic3lzdGVtOnNlcnZpY2VhY2NvdW50OmRlZmF1bHQ6a3ViZXNsaWNlLXJiYWMtcm8tc2xpY2UtYmx1ZSJ9.p_hZ3PSbXufy7d8wAdyLGn_hMjahRP0SVw6qDlCeP_FcPrIHHH1hdWWiNXfSY-RggrdYATGj4iTrDcFgp52pY1pW4yywdGc9zWd19fyreT5UkoM8HvEkV5zbyNuf2tQZRK6zbMjVS-HzwutSdE_M0tpx8zqO2uosLr29kkxG-3qe7DhoOsg04x0NjN9jNw3PQ9l6u48nSg0aUwW2CJAK-7SAp4tUjMnXyh4wxop7mZwimls6VLUoCCqtyACpc9WZNxqO82nCKmnUf6sMTens37PSMz_elM0kMMMUmZhlAcbxy3-fGbHDfjOv1_iaF5K3mbqw5Id0k2-xXcTM7TkUBw"
}
}
Response: ApiKey Secret Malformed
{
"statusCode": 400,
"status": "UNHANDLED_REQUEST_ERROR",
"message": "Api Key Configuration is invalid. Request a new API-key or contact administrator",
"error": {
"errorKey": "UNHANDLED_REQUEST_ERROR",
"message": "Api Key Configuration is invalid. Request a new API-key or contact administrator",
"data": null
}
}
Response: ApiKey Expired
{
"statusCode": 401,
"status": "UNAUTHENTICATED",
"message": "Api Key has expired",
"error": {
"errorKey": "UNAUTHENTICATED",
"message": "Api Key has expired",
"data": null
}
}
Response: Incorrect Key
{
"statusCode": 401,
"status": "UNAUTHENTICATED",
"message": "Unauthenticated",
"error": {
"errorKey": "UNAUTHENTICATED",
"message": "Unauthenticated",
"data": null
}
}
Use the Bearer Token in a Client
Use the following command to get the core API URL:
note
You get the URL only when LoadBalancer is used. For NodePort, use the local port and use that local port address only on that machine.
kubectl get svc -n kubeslice-controller | grep egs-core-apis
Example Output
egs-core-apis LoadBalancer 10.7.45.186 35.145.119.199 8080:31862 64d
Use the /api/v1/auth
generated token as part of the Authorization header in API requests.
Example Request
POST /api/v1/auth
curl -H "Authorization: Bearer <token>" http://localhost:8080/api/v1/slice-workspace