Hosts API
The Hosts API allows you to manage hosts in your app env. You can create, update, and remove hosts.
Make sure to read the Get Started document to understand how the API works.
Get Host
To retrieve a host, send a GET request to the /api/public/v1/app-env/host
endpoint.
You need to provide the following query parameters:
Parameter | Description |
---|---|
envName | The name of the app env. |
hostId or host | Either the host ID or the host name. |
Example:
curl -X GET \
-H 'Authorization: YOUR_TOKEN' \
https://api.zcloud.ws/api/public/v1/app-env/host?envName=little-shop-production&host=example.com
Example Response:
{
"hostId": "5f7b1b7b7b7b7b7b7b7b7b7b",
"host": "example.com",
"status": "VALID",
"isAutoGenerated": false,
"lastValidationAt": "2021-01-01T00:00:00.000Z"
}
The response contain the following fields:
Field | Type | Description |
---|---|---|
hostId | String | The host ID. |
host | String | The host name. |
status | String | The host status. Can be VALID , INVALID , or VALIDATING . |
isAutoGenerated | Boolean | Whether the host is auto-generated by Quave Cloud. |
lastValidationAt | Date | (Optional) The last validation date. |
In the example above, the host example.com
is retrieved from the little-shop-production
app env.
Add a Host
To create a host, send a POST request with the host data to the /api/public/v1/app-env/host
endpoint.
Below are the required fields:
Field | Type | Description |
---|---|---|
envName | String | The name of the app env. |
host | String | The host to be added. |
Example:
curl -X POST \
-H 'Authorization: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"envName": "little-shop-production",
"host": "example.com"
}' \
https://api.zcloud.ws/api/public/v1/app-env/host
In the example, the host example.com
is added to the little-shop-production
app env.
Update a Host
To update a host, send a PUT request to the /api/public/v1/app-env/host
endpoint.
You need to provide the following query parameters:
Parameter | Description |
---|---|
envName | The name of the app env. |
hostId or host | Either the host ID or the current host name to update. |
Also, you need to provide the newHost
in the request body.
Example:
curl -X PUT \
-H 'Authorization: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"newHost": "example2.com"
}' \
'https://api.zcloud.ws/api/public/v1/app-env/host?envName=little-shop-production&host=example.com'
In the example, the host example.com
is updated to example2.com
in the little-shop-production
app env.
Remove a Host
To remove a host, send a DELETE request to the /api/public/v1/app-env/host
endpoint.
You need to provide the following query parameters:
Parameter | Description |
---|---|
envName | The name of the app env. |
hostId or host | Either the host ID or the host name to remove. |
Example:
curl -X DELETE \
-H 'Authorization: YOUR_TOKEN' \
'https://api.zcloud.ws/api/public/v1/app-env/host?envName=little-shop-production&host=example.com'
In the example, the host example.com
is removed from the little-shop-production
app env.