Automates targets creation, modification and deletion.

Base URL https://api.gslb.me/2.0. All requests require HTTP Basic authentication; set Accept to application/json or application/xml. Try these calls in the Postman collection.

Create geohost target

POSThttps://api.gslb.me/2.0/target/{geohost_name}.{zone_name}

Adds a target to an existing geohost. In order to make the changes active, the geohost needs to be committed.

Path parameters

ParameterExampleDescription
{geohost_name}mygeohostName of the geohost, without the zone (the geohost FQDN is geohost_name.zone_name)
{zone_name}mydomain.comName of the zone (domain)

Request body

Send a JSON object (Content-Type: application/json) with these fields; the full request is shown below.

FieldExampleNotes
activetrue“true” or “false”
address2.2.2.3IP address (or FQDN) of the target
aliastarget-2.my.zone.tldAlias of the target
priority5Used by the geolb.priority algorithm
weight7Used by the geolb.weighted algorithm
schedule30
requiredchecks1Number of checks that must succeed
checks[].id29Check id, as returned by Get checks

Example request

cURL
curl -u "username@mydomain.com:your-password" \
  -X POST "https://api.gslb.me/2.0/target/mygeohost.mydomain.com" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "active": "true",
  "address": "2.2.2.3",
  "alias": "target-2.my.zone.tld",
  "priority": "5",
  "weight": "7",
  "schedule": "30",
  "requiredchecks": "1",
  "checks": [
    {
      "id": "29"
    }
  ]
}'
Python
import requests

r = requests.post(
    "https://api.gslb.me/2.0/target/mygeohost.mydomain.com",
    auth=("username@mydomain.com", "your-password"),
    headers={"Accept": "application/json", "Content-Type": "application/json"},
    json={
        "active": "true",
        "address": "2.2.2.3",
        "alias": "target-2.my.zone.tld",
        "priority": "5",
        "weight": "7",
        "schedule": "30",
        "requiredchecks": "1",
        "checks": [
            {
                "id": "29"
            }
        ]
    },
)
print(r.status_code, r.json())
JavaScript
const res = await fetch("https://api.gslb.me/2.0/target/mygeohost.mydomain.com", {
  method: "POST",
  headers: {
    "Authorization": "Basic " + btoa("username@mydomain.com:your-password"),
    "Accept": "application/json",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "active": "true",
    "address": "2.2.2.3",
    "alias": "target-2.my.zone.tld",
    "priority": "5",
    "weight": "7",
    "schedule": "30",
    "requiredchecks": "1",
    "checks": [
      {
        "id": "29"
      }
    ]
  })
});
console.log(res.status, await res.json());

Modify geohost target

PUThttps://api.gslb.me/2.0/target/{geohost_name}.{zone_name}/{target_name}

Modifies a target of an existing geohost. In order to make the changes active, the geohost needs to be committed.

Path parameters

ParameterExampleDescription
{geohost_name}mygeohostName of the geohost, without the zone (the geohost FQDN is geohost_name.zone_name)
{zone_name}mydomain.comName of the zone (domain)
{target_name}2.2.2.3Address of the target

Request body

Send a JSON object (Content-Type: application/json) with these fields; the full request is shown below.

FieldExampleNotes
activetrue“true” or “false”
newname2.2.2.3Target address after the change
aliastarget-99.my.zone.tldAlias of the target
priority33Used by the geolb.priority algorithm
weight33Used by the geolb.weighted algorithm
schedule33
requiredchecks1Number of checks that must succeed
checks[].id29Check id, as returned by Get checks

Example request

cURL
curl -u "username@mydomain.com:your-password" \
  -X PUT "https://api.gslb.me/2.0/target/mygeohost.mydomain.com/2.2.2.3" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
  "active": "true",
  "newname": "2.2.2.3",
  "alias": "target-99.my.zone.tld",
  "priority": "33",
  "weight": "33",
  "schedule": "33",
  "requiredchecks": "1",
  "checks": [
    {
      "id": "29"
    },
    {
      "id": "203"
    },
    {
      "id": "255"
    }
  ]
}'
Python
import requests

r = requests.put(
    "https://api.gslb.me/2.0/target/mygeohost.mydomain.com/2.2.2.3",
    auth=("username@mydomain.com", "your-password"),
    headers={"Accept": "application/json", "Content-Type": "application/json"},
    json={
        "active": "true",
        "newname": "2.2.2.3",
        "alias": "target-99.my.zone.tld",
        "priority": "33",
        "weight": "33",
        "schedule": "33",
        "requiredchecks": "1",
        "checks": [
            {
                "id": "29"
            },
            {
                "id": "203"
            },
            {
                "id": "255"
            }
        ]
    },
)
print(r.status_code, r.json())
JavaScript
const res = await fetch("https://api.gslb.me/2.0/target/mygeohost.mydomain.com/2.2.2.3", {
  method: "PUT",
  headers: {
    "Authorization": "Basic " + btoa("username@mydomain.com:your-password"),
    "Accept": "application/json",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    "active": "true",
    "newname": "2.2.2.3",
    "alias": "target-99.my.zone.tld",
    "priority": "33",
    "weight": "33",
    "schedule": "33",
    "requiredchecks": "1",
    "checks": [
      {
        "id": "29"
      },
      {
        "id": "203"
      },
      {
        "id": "255"
      }
    ]
  })
});
console.log(res.status, await res.json());

Get geohost target

GEThttps://api.gslb.me/2.0/target/{geohost_name}.{zone_name}/{target_name}

Gets a geohost target configuration

Path parameters

ParameterExampleDescription
{geohost_name}mygeohostName of the geohost, without the zone (the geohost FQDN is geohost_name.zone_name)
{zone_name}mydomain.comName of the zone (domain)
{target_name}2.2.2.3Address of the target

Example request

cURL
curl -u "username@mydomain.com:your-password" \
  -X GET "https://api.gslb.me/2.0/target/mygeohost.mydomain.com/2.2.2.3" \
  -H "Accept: application/json"
Python
import requests

r = requests.get(
    "https://api.gslb.me/2.0/target/mygeohost.mydomain.com/2.2.2.3",
    auth=("username@mydomain.com", "your-password"),
    headers={"Accept": "application/json"},
)
print(r.status_code, r.json())
JavaScript
const res = await fetch("https://api.gslb.me/2.0/target/mygeohost.mydomain.com/2.2.2.3", {
  method: "GET",
  headers: {
    "Authorization": "Basic " + btoa("username@mydomain.com:your-password"),
    "Accept": "application/json"
  }
});
console.log(res.status, await res.json());

Delete geohost target

DELETEhttps://api.gslb.me/2.0/target/{geohost_name}.{zone_name}/{target_name}

Deletes a geohost target

Path parameters

ParameterExampleDescription
{geohost_name}mygeohostName of the geohost, without the zone (the geohost FQDN is geohost_name.zone_name)
{zone_name}mydomain.comName of the zone (domain)
{target_name}2.2.2.3Address of the target

Example request

cURL
curl -u "username@mydomain.com:your-password" \
  -X DELETE "https://api.gslb.me/2.0/target/mygeohost.mydomain.com/2.2.2.3" \
  -H "Accept: application/json"
Python
import requests

r = requests.delete(
    "https://api.gslb.me/2.0/target/mygeohost.mydomain.com/2.2.2.3",
    auth=("username@mydomain.com", "your-password"),
    headers={"Accept": "application/json"},
)
print(r.status_code, r.json())
JavaScript
const res = await fetch("https://api.gslb.me/2.0/target/mygeohost.mydomain.com/2.2.2.3", {
  method: "DELETE",
  headers: {
    "Authorization": "Basic " + btoa("username@mydomain.com:your-password"),
    "Accept": "application/json"
  }
});
console.log(res.status, await res.json());