Each API module includes a set of functions which allow access to SingleHop's data. The Dropzone API is a RESTful API which makes use of GET and POST to receive commands and required data. When a data set is returned from the API it is return as a JSON object.
Some functions are dependent on others. For example, if you want to execute the server view command in the server module, you will need to provide SingleHop with the appropriate server ID. To find the right server ID you will first need to run the server list command. The response from the server list command will contain a list of all the servers that you have from SingleHop. From this list of server records you would find the server ID that is required by the server view command.
The API End Point
Each API web request should be directed at:
When sending your username and password you will need to provide it with every command that you send.
For each module that you would like to interact with you will need to send the name of the module with the API endpoint.
Example Request & Response
The entire request put together would look like this;
stdClass Object( [success] => TRUE/FALSE [data] => Array(  => stdClass Object( [status] => Server status (online,offline,provisioning). [serverid] => Server ID number. [os] => Currently installed operating system. [hostname] => Server host name, as in "leap.singlehop.com". [ram] => Amount of RAM and type installed. [type] => Type of server (server,vmnode,vm). [cputype] => Type of CPU that is currently installed. [cpuspeed] => Speed of the installed CPU in GHz. ) ) )
Every response returns 'success' and will always be either TRUE or FALSE, though many replies contain additional data. If success is FALSE then there will be an accompanying message parameter, 'error', which will be returned as well and explain what went wrong.
Using PHP to Connect
We suggest that you use cURL/libcurl to handle requests to Dropzone. Using cURL allows you to gather a ton of extra information about the request (as shown below) instead of just the response -- this could save a lot of time with troubleshooting and connection issues.
Array( [url] => http://dropzone.singlehop.com/server/list [content_type] => text/html; charset=UTF-8 [http_code] => 200 [header_size] => 172 [request_size] => 117 [filetime] => -1 [ssl_verify_result] => 0 [redirect_count] => 0 [total_time] => 0.100578 [namelookup_time] => 2.3E-05 [connect_time] => 7E-05 [pretransfer_time] => 0.000113 [size_upload] => 0 [size_download] => 28 [speed_download] => 278 [speed_upload] => 0 [download_content_length] => 28 [upload_content_length] => 0 [starttransfer_time] => 0.100548 [redirect_time] => 0 [request_header] => GET /server/list HTTP/1.1 Authorization: Basic *****HIDDEN********* Host: dropzone.singlehop.com Accept: application/json )