Skip to main content

Host Management

The host management 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.
Provide the envName and filter fields in the request body.

  • envName: The name of the app env.
  • filter: Used to find the host, either by name or ID.
    • filter.host: The host name.
    • filter._id: The host ID.

Example with host ID:

curl -X GET \
-H 'Authorization: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"envName": "little-shop-production",
"filter": {
"_id": "5f7b1b7b7b7b7b7b7b7b7b7b"
}
}' \
https://api.zcloud.ws/api/public/v1/app-env/host

Example Response:

{
"_id": "5f7b1b7b7b7b7b7b7b7b7b7b",
"host": "example.com"
}

In the example, 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.
Provide the envName and host fields in the request body.

  • envName: The name of the app env.
  • host: 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 with the host data to the /api/public/v1/app-env/host endpoint.
Provide the envName, host, and filter fields in the request body.

  • envName: The name of the app env.
  • host: The new host value.
  • filter: Used to find the host to update, either by name or ID.
    • filter.host: The host name to update.
    • filter._id: The host ID to update.

Example with host ID:

curl -X PUT \
-H 'Authorization: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"envName": "little-shop-production",
"host": "example2.com",
"filter": {
"_id": "5f7b1b7b7b7b7b7b7b7b7b7b"
}
}' \
https://api.zcloud.ws/api/public/v1/app-env/host

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 with the host data to the /api/public/v1/app-env/host endpoint.
Provide the envName and filter fields in the request body.

  • envName: The name of the app env.
  • filter: Used to find the host to remove, either by name or ID.
    • filter.host: The host name to remove.
    • filter._id: The host ID to remove.

Example with host ID:

curl -X DELETE \
-H 'Authorization: YOUR_TOKEN' \
-H 'Content-Type: application/json' \
-d '{
"envName": "little-shop-production",
"filter": {
"_id": "5f7b1b7b7b7b7b7b7b7b7b7b"
}
}' \
https://api.zcloud.ws/api/public/v1/app-env/host

In the example, the host example.com is removed from the little-shop-production app env.