Skip to main content

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:

ParameterDescription
envNameThe name of the app env.
hostId or hostEither 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:

FieldTypeDescription
hostIdStringThe host ID.
hostStringThe host name.
statusStringThe host status. Can be VALID, INVALID, or VALIDATING.
isAutoGeneratedBooleanWhether the host is auto-generated by Quave Cloud.
lastValidationAtDate(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:

FieldTypeDescription
envNameStringThe name of the app env.
hostStringThe 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:

ParameterDescription
envNameThe name of the app env.
hostId or hostEither 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:

ParameterDescription
envNameThe name of the app env.
hostId or hostEither 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.