Simple example

Curl

For this example we use Curl, which is a popular command-line tool for interacting with HTTP services. In this example bellow, we want to get informations on the availability of the domain name example.com

Request

A sample curl request can be the following:
Show/Hidden vim code

View source
 
curl -u login:password api.domainapi.com/v1/availability/example.com
 

Piece of cake, no? But this snippet needs a little bit more explanation in order to study the important part of the request.

  • api.domainapi.com/v1/ is the host on which the request must be realised.
  • availability is the service that we want to call.
  • example.com is the domain on which we want to know the availability.

And last, but not least, even if you don't see it, the request made with the HTTP method GET, permits to notice the webservice that we want to retrieve information for.

Response

Now, a quick look at the web service response in JSON:

Show/Hidden javascript code
View source
{
    "service":"availability",
    "domain":"example.com",
    "timestamp":1234567890,
    "content":{
        "domainList":[
            {
                "status":"taken",
                "name":"example.com"
            }
        ] 
    }
}

In the first part of the response, the webservice remind you your request : the service, and the domain.
After that, you can find the important part, the content of the response. Here the service replies that the status of the domain example.com is taken.

This response skeleton is generic for all the services, the only part which is variable is the content section (defined in the following sections)

What's next ?

That's all for the introduction, to learn more about the technical points of domainAPI you can continue with the next chapter.

Additional information