Template Records API

Template Record attributes

Please refer to the definition of the TemplateRecord data type in our OpenAPI documentation.

List template records

GET /:account/templates/:template/records

Parameters

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

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.

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 on success.

{
  "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
  }
}

Errors

Responds with HTTP 401 in case of case of authentication issues.

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"
  }
}

Errors

Responds with HTTP 400 if the template record cannot be created.

Responds with HTTP 401 in case of case of authentication issues.

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

Responds with HTTP 200 on success.

{
  "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"
  }
}

Errors

Responds with HTTP 401 in case of case of authentication issues.

Delete a template record

DELETE /: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

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.

Errors

Responds with HTTP 400 if the template record cannot be deleted.

Responds with HTTP 401 in case of case of authentication issues.