Linode API

Current Version: 2.3 (2010-07-13)

Introduction

The Linode API is a programmatic interface into many of the Linode Manager's features. The API has been expanded to include not only DNS Manager functions, but also linode creation, control, and deletion.

To use the Linode API you must have a Linode account. The API follows the existing Users and Permissions system, so a user can only perform the operations and actions on instances they have access to. You can create users, restrict permissions, and use their API keys as necessary.

Contributed Bindings and Toolkits

To make your life easier several really awesome people have collaborated and contributed implementations of the Linode API in various languages, so you don't have to.

If you have any questions about the API, these bindings, or would like to have your project listed here, please send an email to api@linode.com.

Getting Started

Authentication

All requests require an API key, with one exception: User.GetAPIKey() can be used to acquire or generate a user's API key through the API itself. API keys can be regenerated on the user's My Profile page at any time.

You can pass in the API key one of two ways: either using HTTP Basic Authentication or by sending an api_key request parameter via GET or POST.

https://abc123@api.linode.com/    # HTTP Basic Authentication 
https://api.linode.com/?api_key=abc123    # Passing via GET variable

There is no authentication method preference, so use the one you're most comfortable with.

Request Format

The api_action parameter is required on every request. All API request parameters and method parameters can be sent via either GET or POST variables.

https://api.linode.com/?api_key=abc123&api_action=test.echo&foo=bar

NOTE: api.linode.com responds only via https://api.linode.com.

Response Format

The optional parameter api_responseFormat can be set to either "json", "wddx" or "human". The default is to output responses in JSON format.

JSON, or JavaScript Object Notation, is a simple, efficient, and easy to use data object serialization method supported in many languages.

WDDX, or Web Distributed Data eXchange, is an alternative to JSON, with the data being encoded within XML.

An api_responseFormat set to "human" will produce output that's easily visually parsed by humans, but not so easy for programs. This is convenient for testing and debugging.

{
	"ERRORARRAY":[],
	"ACTION":"test.echo",
	"DATA":{
		"FOO":"bar"
	}
}
<wddxPacket version='1.0'>
 <header/>
 <data>
  <struct>
   <var name='ERRORARRAY'><array length='0'></array></var>
   <var name='ACTION'><string>test.echo</string></var>
   <var name='DATA'>
    <struct><var name='FOO'><string>bar</string></var></struct>
   </var>
  </struct>
 </data>
</wddxPacket>

Above are example JSON and WDDX responses.

Batching Requests

The Linode API also supports a batched mode, whereby you supply multiple request sets encoded in JSON or WDDX, and receive back an array of responses.

To perform a batch request simply set api_action=batch and place all of your requests in the api_requestArray parameter.

https://api.linode.com/?api_key=abc123&api_action=batch&
api_requestArray=[{"api_action": "test.echo", "foo": "bar"},
{"api_action": "test.echo", "ying": "yang"}]
[
	{
		"ERRORARRAY":[],
		"ACTION":"test.echo",
		"DATA":{"foo":"bar"}
	},
	{
		"ERRORARRAY":[],
		"ACTION":"test.echo",
		"DATA":{"ying":"yang"}
	}
]

Above is an example batch request and the resulting response.

Error Codes

ErrorCodes that can be returned by any method.

0: ok
1: Bad request
2: No action was requested
3: The requested class does not exist
4: Authentication failed
5: Object not found
6: A required property is missing for this action
7: Property is invalid
8: A data validation error has occurred
9: Method Not Implemented
10: Too many batched requests
11: RequestArray isn't valid JSON or WDDX
12: Batch approaching timeout. Stopping here.
13: Permission denied
30: Charging the credit card failed
31: Credit card is expired
40: Limit of Linodes added per hour reached
41: Linode must have no disks before delete



Home | Members | Contact Us | Jobs | Terms of Service | Privacy Policy | ™ © 2003-2010 Linode, LLC. All rights reserved.