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
| Parameter | Example | Description |
|---|---|---|
{geohost_name} | mygeohost | Name of the geohost, without the zone (the geohost FQDN is geohost_name.zone_name) |
{zone_name} | mydomain.com | Name of the zone (domain) |
Request body
Send a JSON object (Content-Type: application/json) with these fields; the full request is shown below.
| Field | Example | Notes |
|---|---|---|
active | true | “true” or “false” |
address | 2.2.2.3 | IP address (or FQDN) of the target |
alias | target-2.my.zone.tld | Alias of the target |
priority | 5 | Used by the geolb.priority algorithm |
weight | 7 | Used by the geolb.weighted algorithm |
schedule | 30 | |
requiredchecks | 1 | Number of checks that must succeed |
checks[].id | 29 | Check id, as returned by Get checks |
Example request
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"
}
]
}'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())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
| Parameter | Example | Description |
|---|---|---|
{geohost_name} | mygeohost | Name of the geohost, without the zone (the geohost FQDN is geohost_name.zone_name) |
{zone_name} | mydomain.com | Name of the zone (domain) |
{target_name} | 2.2.2.3 | Address of the target |
Request body
Send a JSON object (Content-Type: application/json) with these fields; the full request is shown below.
| Field | Example | Notes |
|---|---|---|
active | true | “true” or “false” |
newname | 2.2.2.3 | Target address after the change |
alias | target-99.my.zone.tld | Alias of the target |
priority | 33 | Used by the geolb.priority algorithm |
weight | 33 | Used by the geolb.weighted algorithm |
schedule | 33 | |
requiredchecks | 1 | Number of checks that must succeed |
checks[].id | 29 | Check id, as returned by Get checks |
Example request
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"
}
]
}'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())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
| Parameter | Example | Description |
|---|---|---|
{geohost_name} | mygeohost | Name of the geohost, without the zone (the geohost FQDN is geohost_name.zone_name) |
{zone_name} | mydomain.com | Name of the zone (domain) |
{target_name} | 2.2.2.3 | Address of the target |
Example request
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"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())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
| Parameter | Example | Description |
|---|---|---|
{geohost_name} | mygeohost | Name of the geohost, without the zone (the geohost FQDN is geohost_name.zone_name) |
{zone_name} | mydomain.com | Name of the zone (domain) |
{target_name} | 2.2.2.3 | Address of the target |
Example request
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"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())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());