Create a Recordset

Overview

  • Create a recordset in a zone

Classification

  • Create

API Operation Object

  • Recordset

Synchronous / Asynchronous

  • Synchronous

Request

HTTP Request Method

  • POST

HTTP Request Path

{api_endpoint}/v2/zones/{zone_id}/recordsets

HTTP Request Header

Format

Content-Type: application/json
Accept: application/json
X-Auth-Token: <token_id>

HTTP Request Body

Format

{
  "name" : <name>,
  "description" : <description>,
  "type" : <type>,
  "ttl" : <ttl>,
  "records" : <records>
}

Request Parameter

name style format description required/optional default value action for invalid parameter response code for invalid parameter
token_id Header authentication token string authentication token required - Terminate 401
zone_id path uuid ID for the zone. required - Terminate 400,404
name body hostname DNS Name for the recordset. required - Terminate 400,409
description body string(0-255 characters) Description for this recordset. optional - Terminate 400
type body enum RRTYPE of the recordset. Valid Values: A | AAAA | MX | CNAME | SRV | SPF | TXT | PTR | NS require - Terminate 400
ttl body integer(0-86400) TTL (Time to Live) for the recordset. require - Terminate 400
records body string list A list of data for this recordset. Each item will be a separate record in SDPF DNS. These items should conform to the DNS spec for the record type - e.g. A records must be IPv4 addresses, CNAME records must be a hostname. require - Terminate 400,409

Response

HTTP Response Header

Format

HTTP/1.1 <response_code>       (ex. 200)
  • <response_code>: see "Response Code" section

Response Code

response code status condition message
202 Accepted normal end  
400 Bad Request invalid value E2004 Recordset count reaches the upper limit.
  Bad Request invalid value E2010 Invalid domain name format.
  Bad Request invalid value E2011 Invalid recordset format.
  Bad Request invalid value E2014 Can't set domain name perfect matching zone name.
  Bad Request invalid value E2015 Can't set domain name not end with zone name.
  Bad Request invalid value E2016 Can't set multiple values on PTR recordset.
  Bad Request invalid value E2017 Invalid recordset format. (Must be IPaddress(v4) format.)
  Bad Request invalid value E2018 Invalid recordset format. (Must be IPaddress(v6) format.)
  Bad Request invalid value E2019 Invalid recordset format. (Must be priority and server name.)
  Bad Request invalid value E2020 Priority must be positive integer value. (0 - 65535)
  Bad Request invalid value E2021 Server name must be domain format.
  Bad Request invalid value E2022 Invalid recordset format. (Must be priority and weight and service port and server name.)
  Bad Request invalid value E2023 Priority must be positive integer value. (0 - 65535)
  Bad Request invalid value E2024 Weight must be positive integer value. (0 - 65535)
  Bad Request invalid value E2025 Port must be positive integer value. (0 - 65535)
  Bad Request invalid value E2026 Server name must be domain format.
  Bad Request invalid value E2026 Server name must be domain format.
  Bad Request invalid value E2027 Invalid recordset format. (Must be IPaddress(v4) format or domain name format.)
  Bad Request invalid value E2028 Invalid recordset format. (Must be domain format.)
  Bad Request invalid value E2029 Invalid recordset type.
  Bad Request invalid value E2030 Limit must be positive integer.
  Bad Request invalid value E2064 Can't use wildcard with NS record.
  Bad Request invalid value E2065 Invalid type.
  Bad Request invalid value E2045 TTL value is required.
  Bad Request invalid value E2046 Domain name is required.
  Bad Request invalid value E2047 Recordset type is required.
  Bad Request invalid value E2048 Recordset value is required.
  Bad Request invalid value E2050 Tenant id is required.
  Bad Request invalid value E2056 TTL value must be less than or equal to {max_value}
  Bad Request invalid value E2057 TTL value must be more than or equal to 0
  Bad Request invalid value E2058 Description must input less than or equal to 255.
  Bad Request invalid value E2064 Can't use wildcard with NS record.
  Bad Request invalid value E2039 Nameservers is unavailable.
404 Not found not exists E2006 Specified tenant is not found.
  Not found not exists E2007 Specified zone is not found.
409 conflict conflict E2036 Specified recordset already exists.
  conflict conflict E2037 Specified domain name of CNAME record already exists.
  conflict conflict E2038 Request recordset values conflict.
  conflict conflict E2066 Specified domain name already exists CNAME record.
  conflict conflict E2038 Request recordset values conflict.
401 Unauthorized authentication failure E2001 Invalid token.
500 Internal Server Error internal server error E9001 Internal Server Error. Request failed.

Response Body

Format

{
  "recordsets" : [
    {
      "description": <description>,
      "links": {
          <links>
      },
      "updated_at": <updated_at>,
      "records": <records>,
      "ttl": <ttl>,
      "id": <id>,
      "name": <name>,
      "zone_id": <zone_id>,
      "created_at": <created_at>,
      "version": <version>,
      "type": <type>
    },
    <<repeat>>
   ],
  "links": {
      <links>
  },
  "metadata": {
      <metadata>
  }
}

Response Parameter

item format description
description string Description for this recordset.
updated_at datestamp Date / Time when resource last updated.
records string list A list of data for this recordset. Each item will be a separate record in SDPF DNS. These items should conform to the DNS spec for the record type - e.g. A records must be IPv4 addresses, CNAME records must be a hostname.
ttl integer TTL (Time to Live) for the recordset.
id uuid ID for the resource.
name hostname DNS Name for the recordset.
zone_id uuid ID for the zone that contains this recordset.
created_at datestamp Date / Time when resource was created.
version integer Version of the resource. This parameter is not currently supported. it always return 1.
type string RRTYPE of the recordset.
links links Links to the resource, and other related resources. When a response has been broken into pages, we will include a next link that should be followed to retrieve all results.
metadata metadata Returns the total_count of resources matching this filter.

Sample Request and Response

Sample API Request

Request URL

POST /v2/zones/fbe8562b-66a5-4071-b4c2-250487d15a81/recordsets

Request Header

Content-Type: application/json
Accept: application/json
X-Auth-Token: e8c788fbaeb14964ae19759eb1df4ff1

Request Body

{
  "name": "ex1.example.uk.",
  "description": "This is an example recordset.",
  "type": "A",
  "records": [
    "203.0.113.2",
    "203.0.113.3"
  ],
  "ttl": 3600
}

Sample API Response

Response Header

HTTP/1.1 202
Date: Mon, 24 Oct 2016 04:30:43 GMT
Content-Type: application/json
Content-Length: 984
Connection: keep-alive
Set-Cookie: TS0183560f=01cce65ce15eb774ce7265978bb312260bdec9a0aa6a0d299327650738a31bdbe53d3ed2bd; Path=/

Response Body

{
  "recordsets": [
    {
      "id": "2514d0c1-d41e-4fd0-b736-acf3fbd1e03a",
      "zone_id": "fbe8562b-66a5-4071-b4c2-250487d15a81",
      "records": [
        "203.0.113.2"
      ],
      "ttl": 3600,
      "name": "ex1.example.uk.",
      "description": "This is an example recordset.",
      "type": "A",
      "version": 1,
      "created_at": "",
      "updated_at": null,
      "links": {
        "self": "https://endpoint.api.example.com/v2/zones/fbe8562b-66a5-4071-b4c2-250487d15a81/recordsets/2514d0c1-d41e-4fd0-b736-acf3fbd1e03a"
      }
    },
    {
      "id": "0af8f6a2-e7c8-4243-a7f6-c505725973e4",
      "zone_id": "fbe8562b-66a5-4071-b4c2-250487d15a81",
      "records": [
        "203.0.113.3"
      ],
      "ttl": 3600,
      "name": "ex1.example.uk.",
      "description": "This is an example recordset.",
      "type": "A",
      "version": 1,
      "created_at": "",
      "updated_at": null,
      "links": {
        "self": "https://endpoint.api.example.com/v2/zones/fbe8562b-66a5-4071-b4c2-250487d15a81/recordsets/0af8f6a2-e7c8-4243-a7f6-c505725973e4"
      }
    }
  ],
  "links": {
    "self": "https://endpoint.api.example.com/v2/zones/fbe8562b-66a5-4071-b4c2-250487d15a81/recordsets"
  },
  "metadata": {
    "total_count": 2
  }
}

Sample Error Response

Response

HTTP/1.1 409
Date: Mon, 24 Oct 2016 04:33:50 GMT
Content-Type: application/json
Content-Length: 95
Connection: keep-alive
Set-Cookie: TS0183560f=01cce65ce1d370ff5e297ec1746d9d47dc1312aaa60ae46fd4aa765d67d0b3cae78dc0bd9e; Path=/

{"error":{"code":409,"title":"Conflict","message":"E2036 Specified recordset already exists."}}