Skip to content
Ana Carolina Castro edited this page Mar 15, 2017 · 2 revisions

GloboDNS API

General rules

HTTP response codes

The GloboDNS API follows the RESTful API guidelines and, as such, relies on the HTTP response codes to implicitly convey information about the outcome of a request. Please refer to this page for a through listing of the available codes and their meaning.

The examples in this guide use the cURL utility to send and parse the HTTP requests and responses. We use the '-s' flag on all the examples to supress the default cURL output and improve the clarity readability of the examples. However, whenever troubleshooting an API call, we recommend supressing this flag and additionally enabling the '-v' flag that, amongst other data, will display the HTTP response code.

Request parameters

The examples in this guide encode the request paremeters using the JSON format, to ensure consistency with the format used by the responses. However, this is not a hard requirement: one may encode the request parameters using any valid HTTP content-type scheme.

For example, the following two requests are equivalente -- the first uses JSON encoding (application/json), and the second uses the default "Form URL" encoding (application/x-www-form-urlencoded):

prompt-> curl -s -H 'Content-type: application/json' -X POST -d '{"user": {"email": "admin@example.com", "password": "secret"}}' http://globodns.globoi.com:3000/users/sign_in.json | json-formatter
{
    "authentication_token": "YqTG4j4pdup2GSeXswx9",
    "id": 1
}
prompt-> 

prompt-> curl -s -X POST -d 'user[email]=admin@example.com' -d 'user[password]=secret' http://globodns.globoi.com:3000/users/sign_in.json | json-formatter
{
    "authentication_token": "YqTG4j4pdup2GSeXswx9",
    "id": 1
}
prompt-> 

Notes

Views

Views are supported on version 1.5.25 and later.

Security

Errors

Pretty printing

The examples below use the json-formatter utility to improve the readability of the server responses. This utility is actually a very simple Ruby script that is pasted below for your convenience. Several other alternatives to pretty print JSON data may be found at this page from StackOverflow.com.

prompt-> cat /usr/bin/json-formatter
#!/usr/bin/env ruby

require 'rubygems'
require 'json'

jj JSON.parse(gets(nil))
prompt->

Authentication & Session Management

/users/sign_in

Description: retrieves the authentication_token required to execute any other API calls
URL: http://<hostname>/<optional-app-path>/users/sign_in
Method: POST
Parameters: a JSON object under the key "user" with the attributes email and password
Returns: a JSON object with the user's id and authentication_token attributes
Example:

prompt-> curl -s -H 'Content-type: application/json' -X POST -d '{"user": {"email": "admin@example.com", "password": "secret"}}' http://globodns.globoi.com:3000/users/sign_in.json | json-formatter
{
    "authentication_token": "YqTG4j4pdup2GSeXswx9",
    "id": 1
}
prompt->

Domains

/domains/create

Description: creates a new Domain, along with the mandatory SOA record
URL: http://<hostname>/<optional-app-path>/domains.json
Method: POST
Parameters: a JSON object under the "domain" key, with either 1) the Domain's and SOA record's attributes; or 2) the Domain's name attribute and the zone template name. For example: {"name": "example.globoi.com", "type": "MASTER", "ttl": "86400", "notes": "Sample domain", "primary_ns": "ns.globoi.com.", "contact": "root.globoi.com.", "refresh": 10800, "retry": 3600, "expire": 604800, "minimum": 10800, }, or {"name": "example.globoi.com", "zone_template_name": ""}
Returns: a JSON object representing the created domain
Example:

prompt-> # create domain supplying all attributes
prompt-> curl -s -H 'Content-type: application/json' -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X POST -d '{"domain": {"name": "example.globoi.com", "type": "MASTER", "ttl": "86400", "notes": "Sample domain", "primary_ns": "ns.globoi.com.", "contact": "root.globoi.com.", "refresh": 10800, "retry": 3600, "expire": 604800, "minimum": 10800,"authority_type": "M"}}' http://globodns.globoi.com:3000/domains.json | json-formatter
{
  "domain": {
    "account": null,
    "created_at": "2012-04-04T21:50:26Z",
    "id": 4,
    "last_check": null,
    "master": null,
    "name": "example.globoi.com",
    "notes": "Sample domain",
    "notified_serial": null,
    "ttl": 86400,
    "type": "MASTER",
    "updated_at": "2012-04-04T21:50:26Z",
    "user_id": null
  }
}
prompt->
prompt-> # create domain using a zone template named "Example Template"
prompt-> curl -s -H 'Content-type: application/json' -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X POST -d '{"domain": {"name": "example_from_template.globoi.com", "zone_template_name": "Example Template"}}' http://globodns.globoi.com:3000/domains.json | json-formatter
{ 
  "domain": {
    "id": 7,
    "user_id": null,
    "name": "example_from_template.globoi.com",
    "master": null,
    "last_check": null,
    "notified_serial": null,
    "account": null,
    "ttl": 86400,
    "notes": null,
    "created_at": "2012-04-05T04:53:04Z",
    "updated_at": "2012-04-05T04:53:04Z",
    "authority_type": "M",
    "addressing_type": "N",
    "view_id": 4,
    "sibling_id": null
  }
}

/domains/update

Description: updates one or more attribute from a specified Domain
URL: http://<hostname>/<optional-app-path>/domains/<id>.json
Method: PUT
Parameters: the Domain's id, encoded in the URL itself, plus a JSON encoded object under the key "domain" with the new values for each attribute that should be updated
Returns: an empty string
Example:

prompt-> curl -s -H 'Content-type: application/json' -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X PUT -d '{"domain": {"ttl": 43200}}' http://globodns.globoi.com:3000/domains/7.json
prompt->

/domains/delete

Description: deletes a specified Domain
URL: http://<hostname>/<optional-app-path>/domains/<id>.json
Method: DELETE
Parameters: the Domain's id, encoded in the URL itself
Returns: an empty string
Example:

prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X DELETE http://globodns.globoi.com:3000/domains/7.json
prompt->

/domains/show

Description: displays the attributes of a specified Domain
URL: http://<hostname>/<optional-app-path>/domains/<id>.json
Method: GET
Parameters: the Domain's id, encoded in the URL itself
Returns: a JSON object with the Domain's attributes
Example:

prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET http://globodns.globoi.com:3000/domains/1.json | json-formatter
 {
    "domain": {
      "id": 1,
      "user_id": null,
      "name": "domain.org",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 1,
      "sibling_id": null
    }
  }
prompt->

/domains/index

Description: lists the Domains in the database
URL: http://<hostname>/<optional-app-path>/domains.json
Method: GET
Parameters: view, per_page, page, and query (all optional):
    view: the name of view that the domains belong, use 'all' to search in all views (default: default view)
    per_page: the number of items to return on each "page" (default: 25)
    page: the index of the "page" requested (default: 1)
    query: a string with search terms that will be matched against the domains' "name" attribute. The special character "*" may be used as a wildcard.      reverse=true: return reverse domains. Returns: a JSON array holding objects representing each Domain
Example:

prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET http://globodns.globoi.com:3000/domains.json | json-formatter
[
  {
    "domain": {
      "id": 1,
      "user_id": null,
      "name": "domain.org",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 1,
      "sibling_id": null
    }
  },
  {
    "domain": {
      "id": 2,
      "user_id": null,
      "name": "domain.com",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 1,
      "sibling_id": null
    }
  },
  {
    "domain": {
      "id": 3,
      "user_id": null,
      "name": "globoi.com",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 1,
      "sibling_id": null
    }
  }
]
prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET -G -d per_page=2 http://globodns.globoi.com:3000/domains.json | json-formatter
[
    {
    "domain": {
      "id": 1,
      "user_id": null,
      "name": "domain.org",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 1,
      "sibling_id": null
    }
  },
  {
    "domain": {
      "id": 2,
      "user_id": null,
      "name": "domain.com",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 1,
      "sibling_id": null
    }
  }
]
prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET -G -d per_page=2 -d page=2 http://globodns.globoi.com:3000/domains.json | json-formatter
[
  {
    "domain": {
      "id": 3,
      "user_id": null,
      "name": "globoi.com",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 1,
      "sibling_id": null
    }
  }
]
prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET -G -d query=\*globoi.com http://globodns.globoi.com:3000/domains.json | json-formatter
[
  {
    "domain": {
      "id": 3,
      "user_id": null,
      "name": "globoi.com",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 1,
      "sibling_id": null
    }
  },
  {
    "domain": {
      "id": 4,
      "user_id": null,
      "name": "zone-globoi.com",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 2,
      "sibling_id": null
    }
  }
]
prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET -G -d view=all http://globodns.globoi.com:3000/domains.json | json-formatter
{
    "domain": {
      "id": 1,
      "user_id": null,
      "name": "domain.org",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 1,
      "sibling_id": null
    }
  },
  {
    "domain": {
      "id": 2,
      "user_id": null,
      "name": "domain.com",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 1,
      "sibling_id": null
    }
  },
  {
    "domain": {
      "id": 3,
      "user_id": null,
      "name": "globoi.com",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 1,
      "sibling_id": null
    }
  },
  {
    "domain": {
      "id": 4,
      "user_id": null,
      "name": "zone-globoi.com",
      "master": null,
      "last_check": null,
      "notified_serial": null,
      "account": null,
      "ttl": "86401",
      "notes": null,
      "created_at": "2017-03-14T15:06:50.000-03:00",
      "updated_at": "2017-03-14T15:06:50.000-03:00",
      "authority_type": "M",
      "addressing_type": "N",
      "view_id": 2,
      "sibling_id": null
    }
  }

Records

/records/create

Description: creates a new Record under the specified Domain
URL: http://<hostname>/<optional-app-path>/domains/<domain-id>/records.json
Method: POST
Parameters: the Domain's id encoded in the URL itself, plus a JSON object under the "record" key, with the new Record's attributes. For example: {"name": "sample_record", "type": "MX", "ttl": "86400", "prio": 10, "content": "10.1.2.3"}
Returns: a JSON object representing the created record
Example:

prompt-> curl -s -H 'Content-type: application/json' -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X POST -d '{"record": {"name": "sample_host1", "type": "A", "content": "10.0.0.1"}}' http://globodns.globoi.com:3000/domains/9/records.json | json-formatter
{
  "a": {
    "change_date": 1333658093,
    "content": "10.0.0.1",
    "created_at": "2012-04-05T20:34:53Z",
    "domain_id": 9,
    "id": 41,
    "name": "sample_host1",
    "prio": null,
    "ttl": 43200,
    "updated_at": "2012-04-05T20:34:53Z"
  }
}
prompt->

/records/update

Description: updates one or more attributes from a specified Record
URL: http://<hostname>/<optional-app-path>/records/<id>.json
Method: PUT
Parameters: the Record's id, encoded in the URL itself, plus a JSON encoded object under the key "record" with the new values for each attribute that should be updated
Returns: an empty string
Example:

prompt-> curl -s -H 'Content-type: application/json' -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X PUT -d '{"record": {"name": "sample_host1_updated", "ttl": 43200}}' http://globodns.globoi.com:3000/records/41.json | json-formatter
prompt-> 

/records/delete

Description: deletes a specified Record
URL: http://<hostname>/<optional-app-path>/records/<id>.json
Method: DELETE
Parameters: the Record's id, encoded in the URL itself
Returns: an empty string
Example:

prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X DELETE http://globodns.globoi.com:3000/records/41.json | json-formatter
prompt-> 

/records/show

Description: displays the attributes of a specified Record
URL: http://<hostname>/<optional-app-path>/records/<id>.json
Method: GET
Parameters: the Record's id, encoded in the URL itself
Returns: a JSON object with the Record's attributes
Example:

prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET http://globodns.globoi.com:3000/records/41.json | json-formatter
{
  "a": {
    "change_date": 1333660464,
    "content": "10.0.0.1",
    "created_at": "2012-04-05T20:34:53Z",
    "domain_id": 9,
    "id": 41,
    "name": "sample_host1_updated",
    "prio": null,
    "ttl": 43200,
    "updated_at": "2012-04-05T21:14:24Z"
  }
}
prompt-> 

/records/index

Description: lists all Records that belong to the specified Domain
URL: http://<hostname>/<optional-app-path>/domains/<id>/records.json
Method: GET
Parameters: per_page, page, and query (all optional):
    per_page: the number of items to return on each "page" (default: 25)
    page: the index of the "page" requested (default: 1)
    query: a string with search terms that will be matched against the records' "name" and "content" attributes. The special character "*" may be used as a wildcard.      reverse=true: return reverse records. Returns: a JSON array holding objects representing each stored Record
Example:

prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET http://globodns.globoi.com:3000/domains/9/records.json | json-formatter
[
  {
    "soa": {
      "change_date": 1333660464,
      "content": "ns1.example_from_template.globoi.com template@example.com 2012040510 10800 7200 604800 10800",
      "created_at": "2012-04-05T05:10:07Z",
      "domain_id": 9,
      "id": 34,
      "name": "@",
      "prio": null,
      "ttl": 43200,
      "updated_at": "2012-04-05T21:14:24Z"
    }
  },
  {
    "ns": {
      "change_date": 1333602607,
      "content": "ns1.example_from_template.globoi.com",
      "created_at": "2012-04-03T07:07:31Z",
      "domain_id": 9,
      "id": 35,
      "name": "@",
      "prio": null,
      "ttl": 86400,
      "updated_at": "2012-04-05T04:34:15Z"
    }
  },
  {
    "ns": {
      "change_date": 1333602607,
      "content": "ns2.example_from_template.globoi.com",
      "created_at": "2012-04-03T07:07:31Z",
      "domain_id": 9,
      "id": 36,
      "name": "@",
      "prio": null,
      "ttl": 86400,
      "updated_at": "2012-04-05T04:34:19Z"
    }
  },
  {
    "a": {
      "change_date": 1333602607,
      "content": "10.0.0.1",
      "created_at": "2012-04-03T07:07:32Z",
      "domain_id": 9,
      "id": 37,
      "name": "ns1",
      "prio": null,
      "ttl": 86400,
      "updated_at": "2012-04-03T07:07:32Z"
    }
  },
  {
    "a": {
      "change_date": 1333602607,
      "content": "10.0.0.2",
      "created_at": "2012-04-03T07:07:32Z",
      "domain_id": 9,
      "id": 38,
      "name": "ns2",
      "prio": null,
      "ttl": 86400,
      "updated_at": "2012-04-03T07:07:32Z"
    }
  },
  {
    "a": {
      "change_date": 1333602607,
      "content": "10.0.0.4",
      "created_at": "2012-04-03T07:07:32Z",
      "domain_id": 9,
      "id": 39,
      "name": "mail",
      "prio": null,
      "ttl": 86400,
      "updated_at": "2012-04-03T07:07:32Z"
    }
  },
  {
    "mx": {
      "change_date": 1333602607,
      "content": "mail",
      "created_at": "2012-04-03T07:07:32Z",
      "domain_id": 9,
      "id": 40,
      "name": "@",
      "prio": 10,
      "ttl": 86400,
      "updated_at": "2012-04-05T04:34:32Z"
    }
  },
  {
    "a": {
      "change_date": 1333660464,
      "content": "10.0.0.1",
      "created_at": "2012-04-05T20:34:53Z",
      "domain_id": 9,
      "id": 41,
      "name": "sample_host1_updated",
      "prio": null,
      "ttl": 43200,
      "updated_at": "2012-04-05T21:14:24Z"
    }
  }
]
prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET -G -d per_page=2 http://globodns.globoi.com:3000/domains/9/records.json | json-formatter
[
  {
    "soa": {
      "change_date": 1333660464,
      "content": "ns1.example_from_template.globoi.com template@example.com 2012040510 10800 7200 604800 10800",
      "created_at": "2012-04-05T05:10:07Z",
      "domain_id": 9,
      "id": 34,
      "name": "@",
      "prio": null,
      "ttl": 43200,
      "updated_at": "2012-04-05T21:14:24Z"
    }
  },
  {
    "ns": {
      "change_date": 1333602607,
      "content": "ns1.example_from_template.globoi.com",
      "created_at": "2012-04-03T07:07:31Z",
      "domain_id": 9,
      "id": 35,
      "name": "@",
      "prio": null,
      "ttl": 86400,
      "updated_at": "2012-04-05T04:34:15Z"
    }
  }
]
prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET -G -d per_page=2 -d page=2 http://globodns.globoi.com:3000/domains/9/records.json | json-formatter
[
  {
    "ns": {
      "change_date": 1333602607,
      "content": "ns2.example_from_template.globoi.com",
      "created_at": "2012-04-03T07:07:31Z",
      "domain_id": 9,
      "id": 36,
      "name": "@",
      "prio": null,
      "ttl": 86400,
      "updated_at": "2012-04-05T04:34:19Z"
    }
  },
  {
    "a": {
      "change_date": 1333602607,
      "content": "10.0.0.1",
      "created_at": "2012-04-03T07:07:32Z",
      "domain_id": 9,
      "id": 37,
      "name": "ns1",
      "prio": null,
      "ttl": 86400,
      "updated_at": "2012-04-03T07:07:32Z"
    }
  }
]
prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET -G -d query=mail http://globodns.globoi.com:3000/domains/9/records.json | json-formatter
[
  {
    "a": {
      "change_date": 1333602607,
      "content": "10.0.0.4",
      "created_at": "2012-04-03T07:07:32Z",
      "domain_id": 9,
      "id": 39,
      "name": "mail",
      "prio": null,
      "ttl": 86400,
      "updated_at": "2012-04-03T07:07:32Z"
    }
  },1
  {
    "mx": {
      "change_date": 1333602607,
      "content": "mail",
      "created_at": "2012-04-03T07:07:32Z",
      "domain_id": 9,
      "id": 40,
      "name": "@",
      "prio": 10,
      "ttl": 86400,
      "updated_at": "2012-04-05T04:34:32Z"
    }
  }
]
prompt->

Views

/views/create

Description: creates a new view URL: http://<hostname>/<optional-app-path>/views.json
Method: POST
Parameters: a JSON object under the "view" key, with the new view's attributes. For example: {"name": "sample_view", "clients": "1.2.3.4/16", "destination":nil}
Returns: a JSON object representing the created record
Example:

prompt-> curl -s -H 'Content-type: application/json' -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X POST -d '{"view": {"name": "sample_view", "clients": "10.2.0.0/16", "destination": "nil"}}' http://globodns.globoi.com:3000/viewss.json | json-formatter
{
  "view": {
    "id": 11,
    "name": "sample_view",
    "clients": "10.2.0.0/16",
    "destinations": null,
    "created_at": "2017-03-15T16:41:56.585-03:00",
    "updated_at": "2017-03-15T16:41:56.585-03:00",
    "key": "bWD0DAMp6cv1rB2OEBoiQg=="
  }
}
prompt->

/views/update

Description: updates a specified view
URL: http://<hostname>/<optional-app-path>/view/<id>.json
Method: PUT
Parameters: the view's id, encoded in the URL itself, plus a JSON encoded object under the key "view" with the new values for each attribute that should be updated
Returns: an empty string
Example:

prompt-> curl -s -H 'Content-type: application/json' -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X PUT -d '{"view": {"clients": "10.236.0.0/16}}' http://globodns.globoi.com:3000/views/11.json
prompt->

/views/delete

Description: deletes a specified View
URL: http://<hostname>/<optional-app-path>/views/<id>.json
Method: DELETE
Parameters: the Views's id, encoded in the URL itself
Returns: an empty string
Example:

prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X DELETE http://globodns.globoi.com:3000/views/11.json
prompt->

/view/show

Description: displays the attributes of a specified View
URL: http://<hostname>/<optional-app-path>/views/<id>.json
Method: GET
Parameters: the view's id, encoded in the URL itself
Returns: a JSON object with the View's attributes
Example:

prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET http://globodns.globoi.com:3000/views/11.json | json-formatter
{
  "view": {
    "id": 11,
    "name": "sample_view",
    "clients": "10.236.0.0/16",
    "destinations": null,
    "created_at": "2017-03-15T18:18:06.000-03:00",
    "updated_at": "2017-03-15T18:18:35.000-03:00",
    "key": "EkpyhkEEVECgC2UaqPAmsg=="
  }
}
prompt->

/views/index

Description: lists the View in the database
URL: http://<hostname>/<optional-app-path>/views.json
Method: GET
Parameters: query (optional):
    query: a string with search terms that will be matched against the views's "name" attribute. The special character "*" may be used as a wildcard. Returns: a JSON array holding objects representing each View
Example:

prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET http://globodns.globoi.com:3000/views.json | json-formatter
[
  {
    "view": {
      "id": 4,
      "name": "default",
      "clients": "any;",
      "destinations": null,
      "created_at": "2017-02-14T10:45:46.000-02:00",
      "updated_at": "2017-02-14T10:45:46.000-02:00",
      "key": "t1PkRpF6KDgAEIQ7nYVbng=="
    }
  },
  {
    "view": {
      "id": 7,
      "name": "qa",
      "clients": "10.2.0.0/16;",
      "destinations": "",
      "created_at": "2017-02-16T09:40:32.000-02:00",
      "updated_at": "2017-02-23T10:38:12.000-03:00",
      "key": "6rTKkRxSoq69mduRiEOtYQ=="
    }
  },
  {
    "view": {
      "id": 8,
      "name": "staging",
      "clients": "10.236.0.0/16;",
      "destinations": "",
      "created_at": "2017-02-17T10:48:51.000-02:00",
      "updated_at": "2017-02-23T10:38:18.000-03:00",
      "key": "7Z74QeWkCzx18nfZinzswQ=="
    }
  },
  {
    "view": {
      "id": 11,
      "name": "sample_view",
      "clients": "10.236.0.0/16",
      "destinations": null,
      "created_at": "2017-03-15T18:18:06.000-03:00",
      "updated_at": "2017-03-15T18:21:35.000-03:00",
      "key": "EkpyhkEEVECgC2UaqPAmsg=="
    }
  }
]


prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X GET -G -d query=sample_view http://globodns.globoi.com:3000/views.json | json-formatter
[
  {
    "view": {
      "id": 11,
      "name": "sample_view",
      "clients": "10.236.0.0/16",
      "destinations": null,
      "created_at": "2017-03-15T18:18:06.000-03:00",
      "updated_at": "2017-03-15T18:21:35.000-03:00",
      "key": "EkpyhkEEVECgC2UaqPAmsg=="
    }
  }
]

BIND9 (exporting)

/bind9/schedule_export

Description: signals the end of a set of editing operations and requests an "export" operation to be executed in the next cycle
URL: http://<hostname>/<optional-app-path>/bind9/schedule_export.json
Method: POST
Parameters: none
Returns: a JSON object with a text message stating the expected time when the "export" operation will actually be executed (the expected time is just an estimate, though; it may be delayed due to further updates to the database between the time the "schedule_export" request was submitted and estimated time)
Example:

prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X POST http://globodns.globoi.com:3000/bind9/schedule_export.json | json-formatter
{
  "output": "BIND export scheduled for 2012-07-14 02:35:00 -0300"
}

prompt-> 

/bind9/export

Description: exports the database to BIND's zonefiles, sends the updates to both master and slave servers, and reloads the updated configurations
URL: http://<hostname>/<optional-app-path>/bind9/export.json
Method: POST
Parameters: There are two optional parameters: "now" and "all". When "now" is set to "true", the "export" operation is executed immediately, regardless of the time originally scheduled by the "schedule_operation" request or the configured minimum delay sincethe last database update. When "all" is set to "true", the entire database -- meaning, all views, domains and records -- will be exported (instead of just the ones that were modified since the last successful "export" operation, which is the default).
Returns: a JSON object with a text message stating the result of the export operation
Example:

prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X POST http://globodns.globoi.com:3000/bind9/export.json | json-formatter
{
    "output": "No BIND export scheduled."
}
prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X POST http://globodns.globoi.com:3000/bind9/schedule_export.json | json-formatter
{
    "output": "BIND export scheduled for 2012-07-14 02:43:00 -0300"
}
prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X POST http://globodns.globoi.com:3000/bind9/export.json | json-formatter
{
    "output": "BIND export scheduled for 2012-07-14 02:43:00 -0300"
}
prompt-> curl -s -H 'X-Auth-Token: YqTG4j4pdup2GSeXswx9' -X POST -d now=true http://globodns.globoi.com:3000/bind9/export.json | json-formatter
{ 
    "output": "[GloboDns::Exporter][INFO] git repository ORIG_HEAD: 0ba5bcea2886ec9a5e5d7b5f707827f55cba7e76\n[GloboDns::Exporter][DEBUG] rsync:\nbuilding file list ... done\nreverse/\nslaves/\nzones/\nzones/db.staging.globoi.com\n\nsent 28299 bytes  received 3330 bytes  63258.00 bytes/sec\ntotal size is 1074903  speedup is 33.98\n\n[GloboDns::Exporter][INFO] changes committed:\n[master 39ebcf9] \"[GloboDns::exporter]\"\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\n[GloboDns::Exporter][INFO] git repository new HEAD: 39ebcf909254eb233acb3af5d832163df9af689d\n[GloboDns::Exporter][INFO] bind configuration reloaded:\nserver reload successful\n\n[GloboDns::Exporter][INFO] git repository ORIG_HEAD: 89ac3e142df40043fc953a330b746ae4eb552a19\n[GloboDns::Exporter][DEBUG] rsync:\nbuilding file list ... done\nreverse/\nslaves/\nzones/\n\nsent 322 bytes  received 68 bytes  780.00 bytes/sec\ntotal size is 79110  speedup is 202.85\n\n[GloboDns::Exporter][INFO] bind configuration reloaded:\nserver reload successful\n\n"
}
prompt->