API Documentation of VPS

1. Getting an API Key

You can get the key for the API upon request:

https://cp.inferno.name/api_client.php?action=getApiKey&email={EMAIL}&pass={PASSWORD}
  • {EMAIL} – your email,
  • {PASSWORD} - your password to access your personal account.

2. List of Tariffs and Templates

GET and POST parameters are allowed.

Result:

api_client.php?action=list
  • ostpls - list of templates
  • products - list of tariffs

3. Order Creation

api_client.php?action=create&cid=777&key=XXXXXXXX&pid=303
Input parameters (POST or GET):
  • cid - client id (for example 777)
  • key – client API key
  • pid - product id (from previous function), for example 303.

Result:

{

    "result": "success",

    "orderid": 47000,  // order id, save it.

    "invoiceid": 366000,

    "productids": "49700"

}

4. Getting a List of Orders

Returns both active and unpaid (Pending) orders.

api_client.php? action = orders & cid = 777 & key = XXXXXXXXXXXX
Input parameters (POST or GET):
  • cid - client id, for example 777
  • key - client API key

Result:

"orders": {

        "47200": {

            "id": "47200",

            "ordernum": "8634530000",

            "amount": "5.00",

            "invoiceid": "366000",

            "status": "Pending"

        },

        // ......

}

5. Order Cancellation

You can only cancel Pending (unpaid) order.

api_client.php?action=cancel&cid=777&key=XXXXXXXXX&orderid=46000
Input parameters:
  • cid - client id (for example 777)
  • key - client API key
  • orderid - ID of order to be canceled

Result:

{

    "result": "success"

}

Or:

{

    "result": "fail",

    "message": "Order ID not found or Status not Pending"

}

6. Starting VPS Installation

A paid order is required as an input parameter.

api_client.php?action=install&cid=777&key=XXXXXXX&orderid=47000&ostpl=centos7-64-default&sshkey_ids=NNN&run=1
Input parameters:
  • cid - client id (for example 777)
  • key - client API key
  • orderid - ID of order for which the installation should be started
  • ostpl - the name of the template to install, for example centos7-64-default (see the first function)
  • sshkey_ids - a comma-separated list of SSH key identifiers (e.g. 1,2,3)
  • run - 0 (only check incoming parameters) or 1 (start installation)

An example of a correct answer:

[method] => createVPS

    [result] => success

    [msg] => ok

    [retx] => Array

        (

            [result] => success

            [msg] => VSCD: VPS added to queue

            [error_code] => 0

        )

If the VPS is already being created:

Array

(

    [method] => createVPS

    [result] => fail

    [msg] => Vps exists with current main_id (21968) , W:47012

    [error_code] => 904

)

7. Getting Information About VPS

Getting information about the specified order

api_client.php?action=getinfo&cid=777&key=XXXXXXXXX&orderid=47012

Input parameters:

  • cid - client id (for example 777)
  • key – client API key
  • orderid - the identifier of the order for which you want to get information.

Sample answer:

{

    "result": "success",

    "orderid": 47012,

    "orderStatus": "Active",

    "productStatus": "Active",

    "dedicatedip": "",

    "vps_info": {

        "result": "success",

        "message": "",

        "main_id": "21968",

        "vps_name": "37-1-0-111",

        "ip": "37.1.0.111",

        "real_state": " Included",

        "vps_password": "XXXXXXXXXXX"

    }

}

8. Rebooting the VPS

api_client.php?action=reboot&cid=777&key=XXXXXXXXX&orderid=47012

Input parameters:

  • cid - client id (for example 777)
  • key - client API key
  • orderid - order ID

9. Stopping the VPS

api_client.php?action=stop&cid=777&key=XXXXXXXXX&orderid=47012

Input parameters:

  • cid - client id (for example 777)
  • key - client API key
  • orderid - order ID

10. Starting the VPS

api_client.php?action=boot&cid=777&key=XXXXXXXXX&orderid=47012

Input parameters:

  • cid - client id (for example 777)
  • key - client API key
  • orderid - order ID

11. SSH Authorization Keys

Add SSH key:

action=sshkey.add

sshkey=ssh-rsa AAAAB.. label

After creating a key pair, the contents of the public key file must be URLENCODE encoded.

Example:

api_client.php?action=sshkey.add&cid=777&key=XXXXXXXXX (sshkey send POST request)

Example for CURL:

curl -d "action=sshkey.add&cid=XXXXXX&key=ZZZZZZZZZZZZZZZZZZ&sshkey=ssh-rsa%20AAAA_body_of_public_ssh_key_should_be_here_EvCSSnOQ%3D%3D%20example%40email.here" -X POST -H "Content-Type: application/x-www-form-urlencoded" https://cp.inferno.name/api_client.php

View the list of keys:

api_client.php?action=sshkey.list&cid=777&key=XXXXXXXXX

Delete key:

api_client.php?action=sshkey.remove&cid=777&key=XXXXXXXXX&id=7

If you have any wishes or suggestions for improving the API and adding new functions, please let us know.