dns api call

asked 2014-04-24 01:57:04 -0600

Lokesh gravatar image

Hello ,

           can anyone help me out in designate api call , i am following the documentation "https://designate.readthedocs.org/en/latest/rest/v1/domains.html#create-domain"

Here is my code

  $url = "mywebsite.com";
  $tokenid = "12313wqw121212121";

  $header1=  "X-Auth-Token:".$tokenid;
  $header2 = "Host: $url"; 
  $header3 = "Accept: application/json";
  $header4 = "Content-Type: application/json";

        "name": "domain1.com",
        "ttl": 3600,
        "email": "test@gmail.com"

             $curl = curl_init();
     curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($curl, CURLOPT_POST, true);
     curl_setopt($curl, CURLOPT_URL, $url_send);
     curl_setopt($curl, CURLOPT_HTTPHEADER,array($header1,$header2,$header3,$header4));
     curl_setopt($curl, CURLOPT_HEADER, false);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_POSTFIELDS, $post);

     $response = curl_exec($curl);

The result i am getting here is "Authentication required " . Here i am passing the token-id for authentication bt still its throwing the Authentication error .Can anyone please suggest me where i am going wrong .

Regards , Lokesh.S

edit retag flag offensive close merge delete


Can you successfully use the same token to make a request against another openstack service? Does designate provide any additional information in its server logs?

larsks gravatar imagelarsks ( 2014-04-25 13:46:30 -0600 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-05-23 08:18:47 -0600

grahamhayes gravatar image

You are using the wrong version of the API.

In v1 - domains are called domains

(eg $url:$port/v1/domains )

In v2 they are zones

(eg $url:$port/v2/zones )

also, your post data is wrong, the domain needs the trailing . at the end like

    "name": "domain1.com.",
    "ttl": 3600,
    "email": "test@gmail.com"
edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools

1 follower


Asked: 2014-04-24 01:57:04 -0600

Seen: 206 times

Last updated: May 23 '14