Understanding How The API Works

PHP Examples – Login Resources

Here’s a Ruby example calling REST resources via simple net/https to:

  1. Create a Session Login [POST/Session/]
  2. Grab the Session Token from the Login, and Check the Session is still alive [GET /Session/]
  3. Logout a Session [DELETE /Session/]

Note the http header Auth-Token for passing a Session Token to subsequent commands.

Click to view the example code.

RUBY Examples – Create A Record

Here’s a Ruby example calling REST resources via simple net/https to:

  1. Create a Session Login [POST/Session/], with error checking
  2. Create an A Record at a host [POST /ARecord/#{ZONE}/#{FQDN}/]
  3. Publish the Zone to DNS [PUT /Zone/#{ZONE}/]
  4. Logout a Session [DELETE /Session/]

Note most of the examples here do no error checking (for simplicity of demonstration), you will want to check the ‘status’ of the Response for ‘success’ or ‘failure’ and proceed accordingly. Failed commands will provide messages with information.

Click to view the example code.