The API is reached at https://api.linode.com/api/. The API is interacted with via standard HTTP GET or POST requests with data passed in via form fields and returned in a user specified format.
An API key may be generated/retrieved from the “My Profile" link within the members’ site. API keys are user specific and any restrictions of the associated user are enforced.
See Listing 1 and Listing 2 for a sample minimal request and associated response.
{ "ACTION": "bogus", "ERRORARRAY": [{ "ERRORMESSAGE": "Method Not Found", "ERRORCODE": 666.0 }], "DATA": {}, } |
Parameters are sent as standard form data in name=value pairs via your choice of HTTP POST or GET requests. Field names are case insensitive. With the exception of a three special fields, field names and their value differ based on the method called.
The special field action contains the method you wish to invoke, api_key contains your API key, and resultFormat contains the format for the response. See Table 1 for a list of available formats.
If a specific format for the response is not requested, JSON will be used. There is a top level hash of key-value pairs. Table 2 contains an overview of the object and samples of each type follow.
|
Listing 2 shows an example JSON formatted response for an error. The listing has had additional white-space added for readability, the actual response will contain no extraneous space. Listing 3 contains a full JSON response. JSON is the default response format.
Listing 4 contains a sample WDDX response.
Figure 1 shows a sample human readable response. This response format is intended primarily for debugging.
<wddxPacket version=’1.0’> <header/> <data><struct> <var name=’ACTION’><string>domainGet</string></var> <var name=’ERRORARRAY’><array length=’0’></array></var> <var name=’DATA’> <struct> <var name=’TTL_SEC’><number>0.0</number></var> <var name=’REFRESH_SEC’><number>0.0</number></var> <var name=’DOMAIN’><string>testdomain.com</string></var> <var name=’DOMAINID’><number>23.0</number></var> <var name=’TYPE’><string>master</string></var> <var name=’RETRY_SEC’><number>0.0</number></var> <var name=’SOA_EMAIL’><string>caker@linode.com</string></var> <var name=’STATUS’><number>1.0</number></var> </struct> </var> </struct></data> </wddxPacket> |
Multiple requests may be batched into a single transaction. To send a batch request use action=batch and format your requests as normal with action and associated parameters passed as an array of hashes in JSON or WDDX format in the requestArray field. Listing 5 contains a sample batch request with line breaks and URL decoding to aid in readability.
The response will be an array of replies matching the non-batched format.
GET /api/?API_KEY=<key>&action=batch&ResultFormat=human&requestArray=[ {"action":"domainGet","DomainID":23}, {"action":"domainGet","DomainID":5118.0} ] |
Brief overview of available methods:
Each domain, or zone, in the system has an associated status field. Valid values are listed in Table 15.
|
|
|
|
|
|
|
|
|
|
|
|
Appendices