1.1. Get Started

Enterprise Cloud 2.0 DNS API allows you to create recordsets. Here you can see how to use the API in some basic cases.

Create Recordset

First of all, you might need to know how to use Enterprise Cloud 2.0 DNS. You can create your first recordset by following these steps.

1.Authentication

First, please call the authentication API. You can get authentication token, endpoint URIs, tenant ID for Enterprise Cloud 2.0 DNS API from GUI page.

In following steps, you need to put the authentication token in X-Auth-Token header of API request.

2.Create Zone

You can create a zone that manages a domain.

If you want to know more detail API information, please refer Create a Zone.

$ curl -i -H "Content-Type: application/json"
          -H "Accept: application/json"
          -H "X-Auth-Token: {token_id}"
          -X POST '{api_endpoint}/v2/zones'

Sample Request

{
  "description": "This is an example zone.",
  "email": "example@example.uk",
  "masters": ["ns-example-1.example.com","ns-example-2.example.com"],
  "name": "example.uk.",
  "ttl": 100,
  "type": "PRIMARY"
}

Sample Response

{
  "id":"{id}",
  "pool_id":"",
  "project_id":"{project_id}",
  "name":"example.uk.",
  "email":"",
  "ttl":100,
  "serial":0,
  "status":"CREATING",
  "description":"This is a test zone.",
  "masters":[],
  "type":"",
  "transferred_at":null,
  "version":1,
  "created_at":"2016-10-11T02:07:49",
  "updated_at":null,
  "links":{
    "self":"{api_endpoint}/v2/zones/{id}"
  }
}

3.Create Recordset

You can create a recordset for the domain.

If you know more detail API information, please refer Create a Recordset.

$ curl -i -H "Content-Type: application/json"
          -H "Accept: application/json"
          -H "X-Auth-Token: {token_id}"
          -X POST '{api_endpoint}/v2/zones/{zone_id}/recordsets'

Sample Request

{
  "name": "host1.example.uk.",
  "description": "This is an example recordset.",
  "type": "A",
  "records": ["198.51.100.2","198.51.100.3"],
  "ttl": 3600
}

Sample Response

{
  "recordsets" : [
    {
      "description": "This is an example record set.",
      "links": {
        "self": "{api_endpoint}/v2/zones/{zone_id}/recordsets/{id}"
      },
      "updated_at": null,
      "records": ["198.51.100.2"],
      "ttl": 3600,
      "id": "{recordset_id}",
      "name": "host1.example.uk.",
      "zone_id": "{zone_id}",
      "created_at": "2016-10-11T03:59:44.000000",
      "version": 1,
      "type": "A"
    },
    {
      "description": "This is an example record set.",
      "links": {
        "self": "{api_endpoint}/v2/zones/{zone_id}/recordsets/{id}"
      },
      "updated_at": null,
      "records": ["198.51.100.3"],
      "ttl": 3600,
      "id": "{recordset_id}",
      "name": "host1.example.uk.",
      "zone_id": "{zone_id}",
      "created_at": "2016-10-11T03:59:44.000000",
      "version": 1,
      "type": "A"
    }
  ],
  "links": {
    "self": "{api_endpoint}/v2/zones/{zone_id}/recordsets"
  },
  "metadata": {
    "total_count": 2
  }
    }

List Recordsets

You can get the created recordset list with following API call.

If you want to know more detail API information, please refer List Recordsets in a Zone.

$ curl -i -H "Content-Type: application/json"
          -H "Accept: application/json"
          -H "X-Auth-Token: {token_id}"
          -X GET '{api_endpoint}/v2/zones/{zone_id}/recordsets'

Sample Response

{
      "recordsets":[
            {
              "id":"{recordset_id}",
              "action":"",
              "name":"host1.example.uk.",
              "ttl":3600,
              "description":"This is an example recordset.",
              "records":["198.51.100.2"],
              "type":"A",
              "version":1,
              "status":"ACTIVE",
              "created_at":"2016-10-11T06:44:09",
              "updated_at":"",
              "zone_id":"{zone_id}",
              "links":{
                    "self":"{api_endpoint}/v2/zones/{zone_id}/recordsets/{recordset_id}"
              }
            },
            {
              "id":"{recordset_id}",
              "action":"",
              "name":"host1.example.uk.",
              "ttl":3600,
              "description":"This is an example recordset.",
              "records":["198.51.100.3"],
              "type":"A",
              "version":1,
              "status":"ACTIVE",
              "created_at":"2016-10-11T06:44:09",
              "updated_at":"",
              "zone_id":"{zone_id}",
              "links":{
                    "self":"{api_endpoint}/v2/zones/{zone_id}/recordsets/{recordset_id}"
              }
            }
      ],
      "links":{
        "self":"{api_endpoint}/v2/zones/{zone_id}/recordsets"
      },
      "metadata":{
            "total_count":2
      }
}