Atom feed of this document
 
 
 

 Chapter 9. Add Records

In this section, you will add records for your new domain as follows:

  • Two A records to map the IPV4 addresses of your two Cloud Servers that you recorded in Chapter 3, Create a New Cloud Server to the new domain that you created in Chapter 7, Create a Domain.

  • One CNAME record to create an alias (www.example.com) for your domain with a TTL of 5400 and a comment of “This is a comment on the CNAME record.”

  • Make the first Cloud Server the ftp server (ftp.example.com) for your domain with a TTL of 5571.

  • Make the second Cloud Server the domain server with a TTL of 86400.

[Note]Note

If you had IPV6 addresses to map, you would need to create AAAA records in addition to any A records for IPv4 addresses.

The following examples show the cURL requests for Add Records:

 

Example 9.1. cURL Add Records Request: XML

curl-i -d \
'<?xml version="1.0" ?> 
<recordsList xmlns:ns2="http://docs.rackspacecloud.com/dns/api/management/v1.
0" xmlns="http://docs.rackspacecloud.com/dns/api/v1.0" xmlns:ns3="http://www.
w3.org/2005/Atom">
    <record type="A" name="ftp.example.com" 
    data="<your_FIRST_Cloud_Server_IP_address>" ttl="5771"/>
    <record type="A" name="example.com" 
    data="<your_SECOND_Cloud_Server_IP_address>" ttl="86400"/>
    <record type="CNAME" name="www.example.com" data="example.com" ttl="5400" 
    comment="This is a comment on the CNAME record"/>
</recordsList>' \
-H 'X-Auth-Token: your_auth_token' \
-H 'Content-Type: application/xml' \
-H 'Accept: application/xml' \
'https://dns.api.rackspacecloud.com/v1.0/your_acct_id/domains/domain_id/records'

 

Example 9.2. cURL Add Records Request: JSON

curl -i -d \
'{
    "records": [
        {
            "name" : "ftp.example.com",
            "type" : "A",
            "data" : "<your_FIRST_Cloud_Server_IP_address>",
            "ttl" : 5771
        }, 
        {
            "name" : "example.com",
            "type" : "A",
            "data" : "<your_SECOND_Cloud_Server_IP_address>",
            "ttl" : 86400
        },
        {
            "name" : "www.example.com",
            "type" : "CNAME",
            "comment" : "This is a comment on the CNAME record",
            "data" : "example.com",
            "ttl" : 5400
        }
    ]
}' \
-H 'X-Auth-Token: your_auth_token' \
-H 'Content-Type: application/json' \
'https://dns.api.rackspacecloud.com/v1.0/your_acct_id/domains/domain_id/records'

Remember to replace the names in the examples above with their actual respective values:

The following examples show the initial asynchronous responses for Add Records:

 

Example 9.3. Add Records Initial Asynchronous Response: XML

HTTP/1.1 202 Accepted
X-API-VERSION: 1.0.13
Content-Type: application/xml
Date: Fri, 16 Mar 2012 15:17:52 GMT
Content-Length: 1283
Server: Jetty(7.3.1.v20110307)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<asyncResponse xmlns="http://docs.rackspacecloud.com/dns/api/v1.0" xmlns:ns2="http://www.w3.org/2005/Atom" xmlns:ns3="http://docs.rackspacecloud.com/dns/api/management/v1.0">
  <jobId>1912f480-4636-498e-bba4-609661d19083</jobId>
  <callbackUrl>https://dns.api.rackspacecloud.com/v1.0/1234/status/1912f480-4636-498e-bba4-609661d19083</callbackUrl>
  <status>RUNNING</status>
  <requestUrl>http://dns.api.rackspacecloud.com/v1.0/1234/domains/3191338/records</requestUrl>
  <verb>POST</verb>
  <request>&lt;?xml version=&quot;1.0&quot; ?&gt;
&lt;recordsList xmlns:ns2=&quot;http://docs.rackspacecloud.com/dns/api/management/v1.
0&quot; xmlns=&quot;http://docs.rackspacecloud.com/dns/api/v1.0&quot; xmlns:ns3=&quot;http://www.
w3.org/2005/Atom&quot;&gt;
&lt;record type=&quot;A&quot; name=&quot;ftp.example.com&quot; 
  data=&quot;50.56.207.146&quot; ttl=&quot;5771&quot;/&gt;
&lt;record type=&quot;A&quot; name=&quot;example.com&quot; 
  data=&quot;108.166.67.215&quot; ttl=&quot;86400&quot;/&gt;
&lt;record type=&quot;CNAME&quot; name=&quot;www.example.com&quot; data=&quot;example.com&quot; ttl=&quot;5400&quot;
  comment=&quot;This is a comment on the CNAME record&quot;/&gt;
&lt;/recordsList&gt;</request>
</asyncResponse>


 

Example 9.4. Add Records Initial Asynchronous Response: JSON

HTTP/1.1 202 Accepted
X-API-VERSION: 1.0.13
Content-Type: application/json
Date: Fri, 16 Mar 2012 17:16:16 GMT
Content-Length: 700
Server: Jetty(7.3.1.v20110307)

{
  "request": "{\n\"records\": [\n{\n\"name\" : \"ftp.example.com\",\n\"type\" : \"A\",\n\"data\" : \"50.56.207.146\",\n\"ttl\" : 5771\n},\n{\n\"name\" : \"example.com\",\n\"type\" : \"A\",\n\"data\" : \"108.166.67.215\",\n\"ttl\" : 86400\n},\n{\n\"name\" : \"www.example.com\",\n\"type\" : \"CNAME\",\n\"comment\" : \"This is a comment on the CNAME record\",\n\"data\" : \"example.com\",\n\"ttl\" : 5400\n}\n]\n}",
  "status": "RUNNING",
  "verb": "POST",
  "jobId": "e6b78833-2b5e-4c4c-88c6-6aabb55a706b",
  "callbackUrl": "https://dns.api.rackspacecloud.com/v1.0/1234/status/e6b78833-2b5e-4c4c-88c6-6aabb55a706b",
  "requestUrl": "http://dns.api.rackspacecloud.com/v1.0/1234/domains/3191338/records"
}

The following examples show the cURL asynchronous status requests for Add Records:

 

Example 9.5. cURL Asynchronous Status for Add Records Request: XML

curl -i  \
-H 'X-Auth-Token: your_auth_token' \
-H 'Content-Type: application/xml' \
-H 'Accept: application/xml' \            
'https://dns.api.rackspacecloud.com/v1.0/your_acct_id/status/job_id?showDetails=true'

 

Example 9.6. cURL Asynchronous Status for Add Records Request: JSON

curl -i  \
-H 'X-Auth-Token: your_auth_token' \
-H 'Content-Type: application/json' \
'https://dns.api.rackspacecloud.com/v1.0/your_acct_id/status/job_id?showDetails=true'

Adding the parameter ?showDetails=true at the end of the end of the URL after the job_id causes the response to display all details for the aynch request, including the results, if they are available. Omitting this parameter causes just basic details to be displayed (jobId, callbackUrl, and status attributes).

Remember to replace the names in the examples above with their actual respective values for all the cURL examples that follow:

  • your_auth_token — as returned in your authentication response (see the response examples in Chapter 5, Generate an Authentication Token)

  • your_acct_id — as returned in your authentication response (must be replaced in the request URL)

  • job_id — as returned in your Create Domain response (must be replaced in the request URL)

The following examples show the final successful response for the asynchronous Add Records call. Refer to http://docs.rackspace.com/cdns/api/v1.0/cdns-devguide/content/sync_asynch_responses.html for more information about how the asynchronous call works.

 

Example 9.7. cURL Add Records Final Successful Response: XML

HTTP/1.1 200 OK
X-API-VERSION: 1.0.13
Content-Type: application/xml
Date: Fri, 16 Mar 2012 15:53:22 GMT
Content-Length: 1906
Server: Jetty(7.3.1.v20110307)

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<asyncResponse xmlns="http://docs.rackspacecloud.com/dns/api/v1.0" xmlns:ns2="http://www.w3.org/2005/Atom" xmlns:ns3="http://docs.rackspacecloud.com/dns/api/management/v1.0">
  <jobId>1912f480-4636-498e-bba4-609661d19083</jobId>
  <callbackUrl>https://dns.api.rackspacecloud.com/v1.0/1234/status/1912f480-4636-498e-bba4-609661d19083</callbackUrl>
  <status>COMPLETED</status>
  <requestUrl>http://dns.api.rackspacecloud.com/v1.0/1234/domains/3191338/records</requestUrl>
  <verb>POST</verb>
  <request>&lt;?xml version=&quot;1.0&quot; ?&gt;
&lt;recordsList xmlns:ns2=&quot;http://docs.rackspacecloud.com/dns/api/management/v1.
0&quot; xmlns=&quot;http://docs.rackspacecloud.com/dns/api/v1.0&quot; xmlns:ns3=&quot;http://www.
w3.org/2005/Atom&quot;&gt;
&lt;record type=&quot;A&quot; name=&quot;ftp.example.com&quot; 
  data=&quot;50.56.207.146&quot; ttl=&quot;5771&quot;/&gt;
&lt;record type=&quot;A&quot; name=&quot;example.com&quot; 
  data=&quot;108.166.67.215&quot; ttl=&quot;86400&quot;/&gt;
&lt;record type=&quot;CNAME&quot; name=&quot;www.example.com&quot; data=&quot;example.com&quot; ttl=&quot;5400&quot;
  comment=&quot;This is a comment on the CNAME record&quot;/&gt;
&lt;/recordsList&gt;</request>
  <response xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="recordsList">
    <record id="A-8135987" type="A" name="ftp.example.com" data="50.56.207.146" ttl="5771" updated="2012-03-16T15:17:53Z" created="2012-03-16T15:17:53Z"/>
    <record id="A-8135988" type="A" name="example.com" data="108.166.67.215" ttl="86400" updated="2012-03-16T15:17:53Z" created="2012-03-16T15:17:53Z"/>
    <record id="CNAME-10713155" type="CNAME" name="www.example.com" data="example.com" ttl="5400" updated="2012-03-16T15:17:54Z" created="2012-03-16T15:17:54Z" comment="This is a comment on the CNAME record"/>
  </response>
</asyncResponse>


 

Example 9.8. cURL Add Records Final Successful Response: JSON

HTTP/1.1 200 OK
X-API-VERSION: 1.0.13
Content-Type: application/json
Date: Fri, 16 Mar 2012 16:16:23 GMT
Content-Length: 1455
Server: Jetty(7.3.1.v20110307)

{
"request": "{\n\"records\": [\n{\n\"name\" : \"ftp.example.com\",\n\"type\" : \"A\",\n\"data\" : \"50.56.207.146\",\n\"ttl\" : 5771\n},\n{\n\"name\" : \"example.com\",\n\"type\" : \"A\",\n\"data\" : \"108.166.67.215\",\n\"ttl\" : 86400\n},\n{\n\"name\" : \"www.example.com\",\n\"type\" : \"CNAME\",\n\"comment\" : \"This is a comment on the CNAME record\",\n\"data\" : \"example.com\",\n\"ttl\" : 5400\n}\n]\n}",
  "response": {
    "records": [
      {
        "name": "ftp.example.com",
        "id": "A-8135987",
        "type": "A",
        "data": "50.56.207.146",
        "updated": "2012-03-16T15:17:53.000+0000",
        "ttl": 5771,
        "created": "2012-03-16T15:17:53.000+0000"
      },
      {
        "name": "example.com",
        "id": "A-8135988",
        "type": "A",
        "data": "108.166.67.215",
        "updated": "2012-03-16T15:17:53.000+0000",
        "ttl": 86400,
        "created": "2012-03-16T15:17:53.000+0000"
      },
      {
        "name": "www.example.com",
        "id": "CNAME-10713155",
        "type": "CNAME",
        "comment": "This is a comment on the CNAME record",
        "data": "example.com",
        "updated": "2012-03-16T15:17:54.000+0000",
        "ttl": 5400,
        "created": "2012-03-16T15:17:54.000+0000"
      }
    ]
  },
  "status": "COMPLETED",
  "verb": "POST",
  "jobId": "1912f480-4636-498e-bba4-609661d19083",
  "callbackUrl": "https://dns.api.rackspacecloud.com/v1.0/1234/status/1912f480-4636-498e-bba4-609661d19083",
  "requestUrl": "http://dns.api.rackspacecloud.com/v1.0/1234/domains/3191338/records"
}

You can now call List Domain Details again to confirm that the records are added to your domain. See Chapter 8, List Domain Details for instructions.

This concludes Getting Started. Thank you for using Rackspace Cloud products.