API Documentation
Documentation on the zCompute API and relevant API Endpoints is built-in to every zCompute Cloud. You can access it from the zCompute webUI help menu, found at the top right of every page:
API Explorer
Visiting the API Explorer while logged into your zCompute account will automatically generate a token and copy it to your clipboard:
When testing an authorized API Endpoint, simply click the Authorize button and paste your token to authenticate:
API Token
When using curl
or any other 3rd-party tools a token can be retrieved by making a call against /api/v2/identity/auth
with some key data included. If the authentication was successful, the reply will include the API token in the X-Subject-Token
header.
The included data is as follows (with the username, password, and account name substituted in).
The request data can be scoped to an entire Account as follows:
{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"name": "<USERNAME>",
"password": "<PASSWORD>",
"domain": {
"name": "<ACCOUNT_NAME>"
}
}
}
},
"scope": {
"domain": {
"name": "<ACCOUNT_NAME>"
}
}
}
}
This could also be scoped to a project with:
{
"auth": {
"identity": {
"methods": [
"password"
],
"password": {
"user": {
"name": "<USER_NAME>",
"password": "<PASSWORD>",
"domain": {
"name": "<ACCOUNT_NAME>"
}
}
}
},
"scope": {
"project": {
"domain": {
"name": "<ACCOUNT_NAME>"
},
"name": "<PROJECT_NAME>"
}
}
}
}
Many API calls can only be made when scoped to a project.
An example of this authentication call can be seen below:
curl -s -i -H "Content-Type: application/json" -d '{"auth":{"identity":{"methods":["password"],"password":{"user":{"name":"<USERNAME>","password":"<PASSWORD>","domain":{"name":"<ACCOUNT_NAME>"}}}},"scope":{"domain":{"name":"<ACCOUNT_NAME>"}}}}' "https://<API_ENDPOINT>/api/v2/identity/auth"
This can be extracted cleanly from the above output with:
<AUTH CALL> | grep -i X-Subject-Token | sed 's/[^:]*:[ ]*//'
API Endpoints for AWS Compatibility
zCompute includes a number of AWS-compatible endpoints to allow for the usage of standard APIs for things like EC2 and IAM.
Some boto3 examples can be found here: boto3 for ec2 — zCompute
Access Keys
Access keys for use with the AWS APIs can be generated from the zCompute webUI from the My Account > Access Keys page:
AWS Endpoints
The list of endpoints can be found on the zCompute webUI help menu.