Difference between revisions of "Advanced Cloud Hosting/Cloud API"
Line 24: | Line 24: | ||
Using this API can come in handy for various types of resource information for example you can use the API to list your current server, configure your server, even stop and start lets take a look at a few basic commands. | Using this API can come in handy for various types of resource information for example you can use the API to list your current server, configure your server, even stop and start lets take a look at a few basic commands. | ||
+ | ===List your current servers=== | ||
Use this request to obtain the list of servers owned by the current user | Use this request to obtain the list of servers owned by the current user | ||
<code><pre>https://api.cloud.xmission.com:4464/paci/v1.0/ve</pre></code> | <code><pre>https://api.cloud.xmission.com:4464/paci/v1.0/ve</pre></code> | ||
Line 38: | Line 39: | ||
<code><pre>https://api.cloud.xmission.com:4464/paci/v1.0/ve/server1</pre></code> | <code><pre>https://api.cloud.xmission.com:4464/paci/v1.0/ve/server1</pre></code> | ||
+ | ===More specific server info=== | ||
A sample out put will look like this: | A sample out put will look like this: | ||
<code><pre> | <code><pre> |
Revision as of 12:13, 9 October 2013
If you find yourself with traffic to your website and consistently trying to log in to your Control Panel to adjust your servers RAM to compensate for the heavy load. We have a solution that may help you get some sleep.
Cloud Infrastructure API can Automatically Resize your Server. The RESTful API is on of the most useful and more interesting features of our Cloud Infrastructure service. With the ability to expose nearly all the features of your control panel the API will definitely help you get some 'REST'.
The Cloud Infrastructure RESTful API is well documented and available to all Cloud Infrastructure and Cloud Server subscribers. You can read the full documentation here:
Contents
Accessing a Resource
A PACI resource is accessed by sending an HTTPS request to a PACI server. When the server receives a request, it processes it accordingly (performs actions or retrieves data) and sends back a response that can contain the data that you requested, an operation status code, or an error messate. All PACI resources are accessed at the following URL (referred to as baseURL)
https://{ip_address | hostname}:port/paci/version
where:
- ip_address | hostname is the PACI server IP address or hostname.
- port is the port number on which the server is listening for REST requests
- paci must be typed exactly as shown
- version is the API version number
For our resource the baseURL will use the following:
https://api.cloud.xmission.com:4464/paci/v1.0/
Server Management
Using this API can come in handy for various types of resource information for example you can use the API to list your current server, configure your server, even stop and start lets take a look at a few basic commands.
List your current servers
Use this request to obtain the list of servers owned by the current user
https://api.cloud.xmission.com:4464/paci/v1.0/ve
A sample out put would list your current servers.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ve-list>
<ve-info description="XMission minecraft server" state="STARTED" name="minecraft" subscription-id="1003209"/>
</ve-list>
If you want to be more specific and obtain information about a specific server you can add the server name like this:
https://api.cloud.xmission.com:4464/paci/v1.0/ve/server1
More specific server info
A sample out put will look like this:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ve>
<id>296</id>
<uuid>3c1c50b1.13d794f9065._7ff0</uuid>
<hnId>14</hnId>
<customer-id>1000001</customer-id>
<name>server1</name>
<description>Testing Server</description>
<subscription-id>100001</subscription-id>
<cpu number="4" power="1500"/>
<ram-size>6400</ram-size>
<bandwidth>10000</bandwidth>
<ve-disk created="true" id="0" local="true" size="25"/>
<platform>
<template-info name="ubuntu-12.04-x86_64"/>
<os-info type="ubuntu-12.04-x64" technology="CT"/>
</platform>
<network private-ip="10.0.0.0/8">
<public-ip chunk-ref="1" id="269" address="123.123.123.123/24" gateway="123.123.123.1"/>
</network>
<state>STARTED</state>
<primary-disk-id>0</primary-disk-id>
<template-id>12</template-id>
<admin login="root" password="[hidden]"/>
<steady-state>STARTED</steady-state>
</ve>
Here you can see it shows you all relative information about the server including the number of CPUs, CPU Power, Ram, IP address and much more.
Many more useful command can be used as well - more common would be to start or stop your server.
This documentation is to be used as a guide. Your server will require different settings to optimize your traffic and this code is not perfect. We encourage you to customize it to fit your needs, or write it in a language of your choice. Remember to refer to the documentation.