October 24, 2018

Servers API

  API Reference

     

List Servers

Lists all servers associated with a zone.

Example Request

$ curl https://api.nuevocloud.com/1.0/zones/www.example.com/servers -u nc_apikey:

Example Response

[
{
"active": true,
"hostname": "www.example.com",
"id": "8cdc0c08-5bf9-45f4-a9dd-37e12183b9bb",
"port": 443,
"server": "192.0.2.1",
"use_tls": true,
"verify_certificate": false
}
]

Returned Fields 

Field Default Description
active true Enables or disables this backend server. No requests will be routed to disabled servers.
hostname null An optional hostname for the backend server. If specified, a Host header with the specified hostname will be added to all requests routed to this server.
id   A unique UUID generated to identify this server.
port 80 The port of the HTTP server on the origin server.
server   The IPv4 address or hostname of the origin server. Hostnames will be resolved at the edge and routed to the IPv4 address given by the DNS server.
use_tls false Whether to use TLS when connecting to this origin server.
verify_certificate false When connecting to the origin server with TLS, whether to verify the origin server's certificate is valid. A valid certificate must be issued for the server's hostname by a trusted CA and must not be expired.

List Server Details

List the details for a single server using the server ID.

Example Request

$ curl https://api.nuevocloud.com/1.0/zones/www.example.com/servers/8cdc0c08-5bf9-45f4-a9dd-37e12183b9bb -u nc_apikey:

Example Response

{
"active": true,
"hostname": "www.example.com",
"id": "8cdc0c08-5bf9-45f4-a9dd-37e12183b9bb",
"port": 443,
"server": "192.0.2.1",
"use_tls": true,
"verify_certificate": false
}

Add Servers

Add one or more servers to a zone. A minimum server definition contains the server field.

The server details for each new server is returned.

Example Request

$ curl -X POST -d '[ { "server": "192.0.2.1" } ]' https://api.nuevocloud.com/1.0/zones/www.example.com/servers -u nc_apikey:

Example Response

[
{
"active": true,
"hostname": null,
"id": "a086a5f4-54f1-43cb-8a15-1c98fd886be4",
"port": 80,
"server": "192.0.2.1",
"use_tls": false,
"verify_certificate": false
}
]

Update a Server

Updates a server using the server ID.

The updated server details are returned.

Example Request

$ curl -X POST -d '[ { "port": "443", "use_tls": true, "verify_certificate": true } ]' https://api.nuevocloud.com/1.0/zones/www.example.com/servers/a086a5f4-54f1-43cb-8a15-1c98fd886be4 -u nc_apikey:

Example Response

[
{
"active": true,
"hostname": null,
"id": "a086a5f4-54f1-43cb-8a15-1c98fd886be4",
"port": 443,
"server": "192.0.2.1",
"use_tls": true,
"verify_certificate": true
}
]

Delete a Server

Delete a server from a zone.

Example Request

$ curl -X DELETE https://api.nuevocloud.com/1.0/zones/www.example.com/servers/a086a5f4-54f1-43cb-8a15-1c98fd886be4 -u nc_apikey:

Example Response

{
"status": "ok"
}