3.2 API Guide
Автор Дмитрий Костюк, Last modified by Дмитрий Костюк на 03 February 2014 12:30 PM

The API enables cloud integration with third party applications. You can manage every aspect of your cloud through the API. This guide is a complete reference for all API calls and includes detailed API information, code and output examples. 

All function calls respond to XML and JSON exchange formats
All function calls need authorization and authentication (Basic HTTP or API key)

API Authentication
To authenticate using HTTP Basic, just use your username/password combination. Curl example:
curl –u user:userpass
To authenticate using API key, put your account email as a login and the key to the server as a password.
HTTP Methods
The API uses the following HTTP methods:
GET - used for retrieving information from a particular URI
POST - used for creating new object and adding new transactions into the queue
PUT - used for altering object properties
NOTE: updated_at value is changed in PUT requests even if the request fails.
DELETE - used for object deletion

HTTP response codes
The API returns appropriate HTTP status codes for every request:

200 OK The request completed successfully
204 No content The request completed successfully. The 204 status is returned on DELETE and PUT requests
201 Scheduled The request has been accepted and scheduled for processing
403 Forbidden The request is correct, but could not be processed.
404 Not Found The requested URL is incorrect or the resource does not exist. For example, if you request to delete a user with ID {5}, but there is no such a user in the cloud, you will get a 404 error.
422 Unprocessable Entity The sent parameters are erroneous.
500 Internal Server Error An error occurred. Please contact support.

Formatting and naming conventions
The table below represents all the existing formatting and naming conventions used in this guide:

Convention Explanation Example
user:userpass stands for username:password combination Admin:123456
hostpro.test stands for address, where your Control Panel is located cloud-hostpro.com
:id stands for the resource ID.
Sometimes also: :resource_id
italics all the parameters are italicised currency_code
* (asterisk) marks the required parameters label *
preformatted indicates request examples in XML or JSON GET /roles.xml
  An info message emphasizes or explains the information within the chapter.  
  A note message contains information essential for the task completion.  
  A warning message informs you of something you should not do or be cautious.  


(4 голос(а))
Эта статья полезна
Эта статья бесполезна