Template Records API

List records for a template

GET /:account/templates/:template/records

Parameters

Name Type Description
:account integer The account id
:template integer or string The template id or short name

Example

List records for the template alpha in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/1010/templates/alpha/records

Response

Responds with HTTP 200.

{
  "data": [
    {
      "id": 296,
      "template_id": 268,
      "name": "",
      "content": "192.168.1.1",
      "ttl": 3600,
      "priority": null,
      "type": "A",
      "created_at": "2016-04-26T08:23:54Z",
      "updated_at": "2016-04-26T08:23:54Z"
    },
    {
      "id": 298,
      "template_id": 268,
      "name": "www",
      "content": "{{domain}}",
      "ttl": 3600,
      "priority": null,
      "type": "CNAME",
      "created_at": "2016-04-26T08:25:11Z",
      "updated_at": "2016-04-26T08:25:11Z"
    }
  ],
  "pagination": {
    "current_page": 1,
    "per_page": 30,
    "total_entries": 2,
    "total_pages": 1
  }
}

Sorting

For general information about sorting, please refer to the main guide.

Name Description
id Sort template records by ID
name Sort template records by name (alphabetical order)
content Sort template records by content (alphabetical order)
type Sort template records by type (alphabetical order)

The default sorting policy is by ascending id.

Create a template record

POST /:account/templates/:template/records

Parameters

Name Type Description
:account integer The account id
:template integer or string The template id or short name

Example

Create a record for the template alpha in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      -H 'Content-Type: application/json' \
      -X POST \
      -d '<json>' \
      https://api.dnsimple.com/v2/1010/templates/alpha/records

Input

Name Type Description
record.name string Required. Use an empty string to create a record for the apex.
record.type string Required.
record.content string Required.
record.ttl integer  
record.priority integer  
Example
{
  "name": "",
  "type": "MX",
  "content": "mx.example.com",
  "ttl": 600,
  "priority": 10
}

Response

Responds with HTTP 201 on success.

{
  "data": {
    "id": 300,
    "template_id": 268,
    "name": "",
    "content": "mx.example.com",
    "ttl": 600,
    "priority": 10,
    "type": "MX",
    "created_at": "2016-05-03T07:51:33Z",
    "updated_at": "2016-05-03T07:51:33Z"
  }
}

Responds with HTTP 400 if bad request.

Responds with HTTP 400 if the validation fails.

Get a template record

GET /:account/templates/:template/records/:record

Parameters

Name Type Description
:account integer The account id
:template integer or string The template id or short name
:record integer The record id

Example

Get the record 301 for the template alpha in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      https://api.dnsimple.com/v2/1010/templates/alpha/records/301

Response

{
  "data": {
    "id": 301,
    "template_id": 268,
    "name": "",
    "content": "mx.example.com",
    "ttl": 600,
    "priority": 10,
    "type": "MX",
    "created_at": "2016-05-03T08:03:26Z",
    "updated_at": "2016-05-03T08:03:26Z"
  }
}

Delete a template record

DELETE /:account/zone/:zone/records/:record

Parameters

Name Type Description
:account integer The account id
:template integer or string The template id or short name
:record integer The record id

Example

Delete the record with ID 301 for template alpha in the account 1010:

curl  -H 'Authorization: Bearer <token>' \
      -H 'Accept: application/json' \
      -H 'Content-Type: application/json' \
      -X DELETE \
      https://api.dnsimple.com/v2/1010/templates/alpha/records/301

Response

Responds with HTTP 204 on success.