Understanding How The API Works »
NOTE: The Geo Traffic Management (classic) Service is deprecated. Legacy users of the service should contact Concierge for any questions on adding a Geo Traffic Management service to your zone. All other users should use Traffic Director instead.
Activating or deactivating a Geo Traffic Manager (Classic) service using the API requires specific syntax depending on whether you are using REST or SOAP. Use this table to find the syntax for your command.
REST Syntax
Click to view all REST Resources |
REST/Geo/ PUT — Activate or Deactivate the Geo Traffic Manager (Classic) service on the designated zone node.
HTTP Action — PUT
URI — https://api.dynect.net/REST/Geo/<service_name>/ |
Arguments:
To Activate the Service — boolean activate Required.
To Deactivate the service — boolean deactivate Required. |
Response — Click for More Info
- string
name — Name of the Geo service.
- string
active — Indicates if the service is active.
Valid values:
Y if the service is active.
N if the service is inactive.
- array
groups — A list of Region Groups that are defined for the service.
- string
name — Name of the Region Group.
- array
countries — A list ISO-3166 codes to represent the names of countries and their subdivisions.
- array
rdata — The RData to be served for the Region Group.
- hash
weight — Weight for each record that is entered.
- hash
serve_count — Serve count for each record.
- hash
ttl — TTL for each record.
- array
nodes — A list of zone and FQDN pairs to identify nodes that are attached to the Geo service.
- string
fqdn — Fully qualified domain name of a node in the zone.
- string
zone — Name of the zone.
|
Examples — Click for More Info
This example uses the DynECT API Python Wrapper.
Basic steps included in the sample:
- Session Login
- Create a Geo Service with one Geo Region Group and linked to one node [POST /Geo/<service_name>/]
- Update a Geo Service linking it to one node [PUT /Geo/{service_name}/]
- Session Log-Out
Sample Python Script — Click for More Info
#!/usr/bin/env python
"""
Dynect API REST Examples
Logs into the API, creates a brand new Geo Service
that is NOT linked any nodes, updates the Geo Service,
deletes the Geo Service, and then logs out.
"""
from DynectDNS import DynectRest
from optparse import OptionParser
from pprint import PrettyPrinter
import sys
api = DynectRest()
# We need to login
print "Logging in to API"
args = {
'customer_name': '<customer_name>',
'user_name': '<user_name>',
'password': '<password>',
}
response = api.execute('/REST/Session/', 'POST', args)
if response['status'] != 'success':
pretty = PrettyPrinter()
msg = "Login to API failed: %s" % pretty.pformat(response)
sys.exit(msg)
"""
Create Geo
To create a Geo service, one must specify a unique
name and define at least one Geo Region Group. At
this time, the user can choose whether or not to
link this service to a node.
A Geo Region Group consists of a unique name, a
list of countries that the group represents, and
rdata that will be served.
"""
svc_name = 'example geo'
groups = [{
'name' : 'example group',
'countries' : ['US'],
'rdata' : {
'a_rdata':[{
'address':'9.9.9.9'
}]
}
}]
create_args = {
'groups': groups,
}
print "Creating the Geo Service"
url = "/REST/Geo/%s/" % svc_name
response = api.execute(url, 'POST', create_args);
# If the command failed, tell us why
if response['status'] != 'success':
pretty = PrettyPrinter()
msg = "Creating the Geo Service failed: %s" % pretty.pformat(response)
sys.exit(msg)
nodes = [
{'zone': 'example.com', 'fqdn': 'example.com'},
]
update_args = {
'nodes': nodes,
}
"""
UpdateGeo
To update a Geo service, one must identify it using
the name specified at the time of creation.
Only the fields specified are updated. For example, if
a node is to be linked to the Geo Service, 'Groups'
do not need to be specified.
"""
print "Updating the Geo Service"
url = "/REST/Geo/%s/" % svc_name
response = api.execute(url, 'PUT', update_args);
# If the command failed, tell us why
if response['status'] != 'success':
pretty = PrettyPrinter()
msg = "Updating the Geo Service failed: %s" % pretty.pformat(response)
sys.exit(msg)
print "Logging out"
api.execute('/REST/Session/', 'DELETE')
|

SOAP Syntax
Click to view all SOAP Commands |
ActivateGeo — Activates an existing Geo Traffic Manager service.
DeactivateGeo — Deactivates an existing Geo Traffic Manager service. |
Arguments:
ActivateGeo:
string name — Required. Name of the service.
string token — Required. The session identifier
DeactivateGeo:
string name — Required. Name of the service.
string token — Required. The session identifier. |
Response (both Activate and Deactivate) — Click for More Info
- hash
data
- string
name — Name of the Geo service.
- string
active — Indicates if the service is active.
Y if the service is active.
N if the service is inactive.
- array
groups — A list of Region Groups that are defined for the service.
- string
name — Name of the Region Group.
- array
countries — A list ISO-3166 codes to represent the names of countries and their subdivisions.
- array
rdata — The RData to be served for the Region Group.
- array
nodes — A list of zone and FQDN pairs to identify nodes that are attached to the Geo service.
- string
fqdn — Fully qualified domain name of a node in the zone.
- string
zone — Name of the zone.
|
Example Request — Click for More Info
{
'name'=>'Example Geo',
'token'=> 'zaq12wsxcDe34rf89gt56nh',
}
|
<< DNS API Knowledge Base