VPS Cloud Sites—Next Generation Web Hosting
This guide outlines the basic principles of using the VPS.NET RESTful API to manage your account and cloud servers. If you have any questions about using this system, please don't hesitate to contact the VPS.NET support team.
This documentation is program language-independent and our examples will use command-line CURL to send the requests to VPS.NET
To authenticate to the API, use your email address and generated API key.
To generate a key:
If you are developing a web-based application, please be sure to store the credentials safely outside the document root and be cautious about checking them into any source control system you may be using.
Send the credentials using HTTP Basic authentication with every request you make to the API. All API sessions are stateless.
To request data, you need to send the appropriate HTTP headers along with your authentication credentials to the following URL:
curl -H 'Accept: application/json' -H 'Content-type: application/json' -u dave@vps.net:abc123ABC456== https://api.vps.net/virtual_machines.api10json
Where:
.api10json
dave@vps.net:abc123ABC456==
Gets the list of all cloud servers on your account.
[{
"virtual_machine":
{
"running": true,
"updated_at": "2009-05-15T06:55:02-04:00",
"power_action_pending": false,
"system_template_id": 41,
"id": 1384,
"cloud_id": 3,
"domain_name": "demodomain.com",
"hostname": "web01",
"consumer_id": 0,
"backups_enabled": false,
"password": "a8hjsjnbs91",
"label": "Web Server 01",
"slices_count": null,
"created_at": "2009-04-16T08:17:39-04:00",
"bandwidth_used":8255683,
"delayed_storage":true,
"delayed_storage_until":"2010-05-01T10:00:00-04:00"
}
},
{
"virtual_machine":
{
"running": true,
"updated_at": "2009-05-15T06:55:02-04:00",
"power_action_pending": false,
"system_template_id": 41,
"id": 1385,
"cloud_id": 3,
"domain_name": "demodomain.com",
"hostname": "mysql01",
"consumer_id": 0,
"backups_enabled": false,
"password": "dsi8h38hd2s",
"label": "MySQL Server 01",
"slices_count": null,
"created_at": "2009-04-16T08:17:39-04:00",
"bandwidth_used":2345678,
"delayed_storage":false,
"delayed_storage_until":null
}
}]
Where:
running
power_action_pending
built
system_template_id
cloud_id
backups_enabled
password
bandwidth_used
delayed_storage
delayed_storage_until
Other fields are self-explanatory.
Note: You can pass basic=true parameter to skip some attributes(bandwidth_used, running) to get faster response.
See above for example output and field definitions
Search param can be IP address, hostname, domain name, vm label or tag.
{
"virtual_machine":
{
"label": "My Cloud Server",
"fqdn": "myvps.mydomain.net",
"system_template_id": 9,
"cloud_id":1,
"backups_enabled": false,
"rsync_backups_enabled": false,
"r1_soft_backups_enabled": false,
"slices_required": 4,
"server_monitoring_service_required": "1",
"server_monitoring_configuration_service_required": "1"
}
}
To purchase control panel or add-on licensing for your cloud server, add a licenses array into virtual_machine array(see code sample below), use the array with license_id:value (1 - purchase license, 0 - cancelling license). Use Get Cloud Server Licenses call to get license ids.
Note: You can only purchase one control panel license (e.g. cPanel or ISPmanager). To purchase Control Panel Add-ons, buy the control panel first.
{
"virtual_machine":
{
"backups_enabled": false,
"rsync_backups_enabled": false,
"r1_soft_backups_enabled": false,
"label": "D Tester",
"slices_required": 3,
"licenses":
{
"2":1,
"1":0
}
}
}
Where:
label
fqdn
system_template_id
cloud_id
backups_enabled
rsync_backups_enabled
r1_soft_backups_enabled
server_monitoring_service_required
server_monitoring_configuration_service_required
{
"instant":true
"country":1
}
Where:
country
Run this command on machines which are powered on.
Run this command on machines which are powered on.
Run this command on machines which are powered off.
Run this command on machines which are powered on.
To rebuild a pending cloud server.
Note: Your cloud server will be rebooted and the network interfaces configuration file on this cloud server will be regenerated.
You can edit cloud server properties including node allocations.
To edit a cloud server (e.g. change the consumer_id for it), you should use the HTTP PUT method to deliver a JSON object. On every request, this must include the number of nodes required (field: slices_required).
{
"virtual_machine":
{
"backups_enabled": false,
"consumer_id": 1,
"label": "D Tester",
"slices_required": 3
}
}
Where:
public_fqdn
You can set the amount of daily nodes instead of regular, as well as storage nodes:
Bandwidth Nodes are available only on selected clouds. Use GET properties for a Cloud call to get a list of such clouds.
{
"virtual_machine":
{
"backups_enabled": true,
"consumer_id": 118,
"label": "Daily node tester",
"daily_nodes_required": 2,
"storage_nodes_required": 1,
"ram_nodes_required": 1,
"bandwidth_nodes_required": 1,
}
}
You can upgrade slices for an existing cloud server but defer the disk resize to an optional date:
{
"virtual_machine":
{
"slices_required": 3,
"delayed_storage": true,
"delayed_storage_until": "2010-04-24 14:00"
}
}
Note: The datetime for delayed_storage_until should be in Eastern Time (US & Canada) timezone.
To edit a licenses on your cloud server, use the HTTP PUT method to deliver a JSON object. On every request, this must include the number of nodes required (field: slices_required) and licenses array with license id and value (1 - purchase license, 0 - cancelling license). Use Get Cloud Server Licenses call to get license ids.
Mind that you can only purchase one control panel license (e.g.: cPanel or ISPmanager), if you want to purchase another one, you have to delete existing control panel license first. If you delete control panel license, do not forget to delete all Control Panel Add-ons licenses either.
{
"virtual_machine":
{
"backups_enabled": false,
"label": "D Tester",
"slices_required": 3,
"licenses":
{
"2":1,
"1":0
}
}
}
Gets the rsync backup info for a specific cloud server.
{ "username":1000, "quota":"0.00 GB out of 10 GB", "password":"GGD3sH" }
Converts an existing backup to a template.
{ "one_click":true }
Restores an existing backup.
You may pass 'from' and 'to' with timestamps as params to get usage data during a specific timespan.
You may pass 'from' and 'to' with timestamps as params to get usage data during a specific timespan.
{"accept": '1', "virtual_machine_id": 1385}
{"virtual_machine": {"system_template_id": 92} }
Cloud server will be rebooted in order to reset the password.
Note: Upgrading your storage will cause downtime on your Cloud Server.
This will put the cloud server on a recoverable state for 12 hours since the time cloud server was deleted. You may recover the cloud server using recover vps API method.
Options
"{'reassign_ip':'1234', 'alternate_vps':'1221'}"
Pro-Active Managed Service service cannot be transfered to a Windows cloud server.
Gets the list of nodes.
When regular monthly nodes are returned, this will include a daily_node param which denotes if the slice is a daily billed slice.
To filter by consumer_id:
https://api.vps.net/nodes.api10json?type={ram|storage|fusion|vps|bandwidth}&consumer_id={CONSUMER_ID}
To create a node:
{"quantity": 1}
To create a RAM node:
{"quantity": 1, "upgrade_option": "ram"}
To create 2 storage nodes:
{"quantity": 2, "upgrade_option": "storage"}
To create 3 daily nodes:
{"quantity": 3, "upgrade_option": "daily"}
To create 2 bandwidth nodes:
{"quantity": 2, "upgrade_option": "bandwidth"}
Mind that Paypal based accounts are not compatible with this API function
Pro-rated payment for additional nodes will be taken immediately, and nodes will be billed monthly (or daily for daily nodes) until removed from the account.
Edit node properties.
{"consumer_id": 99}
Currently only consumer_id can be edited.
To update a regular monthly node:
https://api.vps.net/nodes/{ID}.api10json
To update a RAM node:
https://api.vps.net/nodes/{ID}/update_ram_node.api10json
To update a storage node:
https://api.vps.net/nodes/{ID}/update_storage_node.api10json
To update a fusion node:
https://api.vps.net/nodes/{ID}/update_fusion_node.api10json
To update a Bandwidth node:
https://api.vps.net/nodes/{ID}/update_bandwidth_node.api10json
To delete a regular monthly node:
https://api.vps.net/nodes/{ID}.api10json
To delete a RAM node:
https://api.vps.net/nodes/{ID}/remove_ram_node.api10json
To delete a storage node:
https://api.vps.net/nodes/{ID}/remove_storage_node.api10json
To delete a fusion node:
https://api.vps.net/nodes/{ID}/remove_fusion_node.api10json
To delete a Bandwidth node:
https://api.vps.net/nodes/{ID}/remove_bandwidth_node.api10json
This will remove the node from your account. Once removed, it will no longer be billed, and cannot be used. You can delete nodes only if they are not assigned to a cloud server.
Gets the list of your IP addresses
Adds IP addresses.
{"quantity": 1, "type": "internal", "virtual_machine_id": 99, "consumer_id": 58}
Note: If a consumer_id is set on an IP address, note that the IP will only work on Cloud Servers with the matching consumer_id.
Set or edit description / consumer_id for each IP addresses.
{"ip_address":{"notes": "description", "consumer_id": 58}}
Request for adding justified Ip Address.
"{'virtual_machine_id': 99 , 'ip_justification' : {'ip_address1':{'justification_type' : '0', 'justification_reason': 'test.com' },{'ip_address2':{'justification_type' : '1', 'justification_reason': 'test' }}}"
Where:
justify_as
Gets the list of your Justified IP addresses list
This will remove the IP from your account. Once removed, it will no longer be billed, and cannot be used.
Reassign an IP address to the cloud server of your choice. Please note IPs can only be reassigned to a cloud server on the same cloud.
"{'virtual_machine_id':'12345'}"
{"ip_address": "68.169.23.153"}
Gets the full list of all backups for a specific cloud server.
[
{
"built_at": "2011-01-07T15:44:43Z",
"disk_id": 765,
"operating_system_distro": "ubuntu",
"created_at": "2011-01-07T20:43:33+05:30",
"template_id": 7,
"operating_system": "linux",
"allowed_swap": true,
"updated_at": "2011-01-07T21:14:43+05:30",
"backup_type": "normal",
"allow_resize_without_reboot": false,
"id": 3774, "backup_size": "510340",
"min_disk_size": 5,
"identifier": "zvgrwpkoi16qfq",
"built": true,
"locked":false
}]
Where:
built_at
disk_id
template_id
backup_type
min_disk_size
identifier
built
locked
Delete a virtual machine backup.
Note: Only manual backups can be deleted.
Gets the full list of all the cloning activity of a Cloud Server.
[
{"clone":
{
"label": "test_clone_machine",
"id": 86,
"status": "Cloned successfully",
"created_at": "2014-03-10T18:23:10+05:30",
"cloned_server_id": 2978
}
}]
{
"cloud_id": 15,
"one_click": true,
"one_clone": true
}
Where:
cloud_id
one_click
one_clone
Note: Your cloud server will be cloned in the same cloud unless you pass cloud_id.
Delete a clone.
{
"id": 543,
}
Where:
id
Gets the list of available clouds
[
{
"cloud":
{
"label": "test cloud",
"available": true,
"system_templates": [
{
"label": "Ubuntu 8.04 x64",
"id": 78
},
{
"label": "Ubuntu 10.04 x64",
"id": 92
}],
"fusion_io": false,
"id": 153,
"cloud_version": 1,
"premium_price": 0,
"currency_code": "USD"
"daily_node_bandwidth": 100,
"monthly_node_bandwidth": 150
}
}]
Note: Bandwidth per node value will return in GB.
Gets the list of available SSD clouds
[
{
"cloud":
{
"label": "test SSD cloud",
"available": true,
"system_templates": [
{
"label": "Ubuntu 8.04 x64",
"id": 78
},
{
"label": "Ubuntu 10.04 x64",
"id": 92
}],
"id": 160,
"cloud_version": 1,
"premium_price": 0,
"currency_code": "USD"
"daily_node_bandwidth": 100,
"monthly_node_bandwidth": 150
}
}]
Use Create SSD VPS to create a new SSD VPS.
{
"label":"Test Cloud",
"available":true,
"system_templates":
[{
"label":"Ubuntu 8.04 x64",
"id":78
},
{
"label":"10.04 (Lucid) x64",
"id":87
}],
"cluster_stats":
{
"stats":
{
"memory":
{
"usage":"3488",
"total":"4094",
"free":"606"
},
"tasks":
{
"pending":"3"
},
"templates":
{
"system":"72",
"custom":"148"
},
"disk_space":
{
"usage":"150.0",
"total":"232.0",
"free":"82.0"
}
}
},
"fusion_io":false,
"id":3,
"cloud_version":1
}
Gets the list of available cloud groups
Gets the list of all domains on your account.
[{
"domain":
{
"name": "demodomain.com",
"updated_at": "2009-05-15T06:55:02-04:00",
"id": 51,
"created_at": "2009-05-15T06:55:02-04:00"
}
},
{
"domain":
{
"name": "demodomain2.com",
"updated_at": "2009-05-15T06:55:02-04:00",
"id": 52,
"created_at": "2009-05-15T06:55:02-04:00"
}
}]
{
"domain":
{
"name": "demodomain.com",
"custom_template": "",
"ip_address": "127.0.0.1"
}
}
Where:
name
custom_template
ip_address
{
"domain":
{
"name": "demodomain.com",
"updated_at": "2009-05-15T06:55:02-04:00",
"id": 51,
"serial": "2010080405",
"created_at": "2009-05-15T06:55:02-04:00"
}
}
Gets the list of the all records of your domain.
[{
"domain_record":
{
"ttl": 86400,
"type": "a",
"id": 2315958,
"host": "www",
"data": "127.0.0.1"
}
},
{
"domain_record":
{
"ttl": 300,
"type": "failover",
"id": 2315959,
"host": "@",
"data": ["127.0.0.1", "127.0.0.2", "127.0.0.3"]
}
}]
Where:
ttl
type
host
data
For NS, A, AAAA, MX, TXT, CNAME record type
{
"domain_record":
{
"ttl": 86400,
"data": "dns1.vps.net."
"type": "ns",
"host": "@"
}
}
Where:
ttl
type
host
data
mx_priority
For SRV record type
{
"domain_record":
{
"ttl": "86400",
"data": "test.example.com",
"type": "srv",
"host": "_sip._tcp.example.com",
"service": "testservice",
"protocol": "_udp",
"priority": "10",
"weight": "60",
"port": "5060"
}
}
Where:
ttl
type
host
data
priority
service
protocol
weight
port
For FAILOVER record type
{
"domain_record":
{
"data": ["127.0.0.2", "127.0.0.3"],
"type": "failover",
"host": "www",
"primary_data": "64.152.33.1",
"service_type": "icmp.ping"
}
}
Where:
type
host
primary_data
data
service_type
{
"domain_record":
{
"ttl": 86400,
"data": "127.0.0.1"
}
}
{
"domain_records":
[
{
"domain_record":
{
"ttl":86400,
"type":"soa",
"host":"@",
"data":"dns1.vps.net."
}
},
{
"domain_record":
{
"ttl":86400,
"type":"ns",
"host":"@",
"data":"dns1.vps.net."
}
},
{
"domain_record":
{
"ttl":86400,
"type":"ns",
"host":"@",
"data":"dns2.vps.net."
}
},
{
"domain_record":
{
"ttl":86400,
"mx_priority":10,
"type":"mx",
"host":"@",
"data":"mail.domain.com."
}
},
{
"domain_record":
{
"ttl":86400,
"type":"a",
"host":"@",
"data":"127.0.0.1"
}
},
{
"domain_record":
{
"ttl":86400,
"type":"a",
"host":"www",
"data":"127.0.0.1"
}
}
]}
See above for example output and field definitions
Gets the list of Service Type Textkeys
Gets the list of ips and hosts of vps.net NS records
[{
"host": "dns1.vps.net",
"ip":"67.228.254.4"
},
{
"host":"dns2.vps.net",
"ip":"67.228.255.5"
}]
[{
"dns_template":
{
"template_name": "demotemplate1",
"updated_at": "2009-05-15T06:55:02-04:00",
"id": 51,
"created_at": "2009-05-15T06:55:02-04:00"
}
},
{
"dns_template":
{
"template_name": "demotemplate2",
"updated_at": "2009-05-15T06:55:02-04:00",
"id": 52,
"created_at": "2009-05-15T06:55:02-04:00"
}
}]
{
"dns_template":
{
"template_name": "demotemplate",
}
}
Gets the list of the all records of your dns template.
{
"dns_template_record":
{
"dns_template_id": 55,
"ttl": 86400,
"type": "ns",
"host":"@",
"data": "dns1.vps.net."
}
}
Where:
ttl
type
host
data
mx_priority
{
"dns_template_record":
{
"target": "127.0.0.5",
"ttl":900
}
}
Gets the list of tickets.
[{
"ticket":
{
"status": "Open",
"department": "Billing",
"id": "979",
"subject": "API test subject"
"last_responded": "Staff Followup",
"last_response_time": "2010-08-09T08:02:00-04:00"
}
}]
Where:
status
department
Other fields are self-explanatory.
To filter by ticket status:
https://api.vps.net/tickets.api10json?status={open|closed|hold}
To filter by status and department:
https://api.vps.net/tickets.api10json?status={open|closed|hold}&department={DEPARTMENT_ID}
Departments Ids:
Billing - 1, Sales - 2, Wordpress - 3, Cloud Hosting -4, Server issue - 5, Other - 6
Techinical Issue Subject Type
Server is Down - "reboot" Server Performance Issue - "performance_issue" Installation Request - "installation" Server Administration Request - "administration" Assisted Start-up Request - "assisted" Abuse / DDoS - "abuse" Unknown / Other - "other"To create a issue that demands 'Sales' or 'Billing' or 'Other'
{
"department": "1",
"body": "This is a test body",
}
Where:
department
Body
Department id should be '3' or '4' for wordpress/CH. Change here
{
"department": "3",
"body": "This is a test body",
"domain_name" : "www.test.com"
}
Where:
department
Body
domain_name
To Open a ticket for Tech issue
{
"subject": "reboot",
"body": "This is a test body",
"department": "5"
"vm_id": 520,
"root_password": "F4334Y!",
'ssh_port": "345",
"ssh_user": "test",
"ssh_password": "df345dd"
}
Where:
department
Body
subject
vm_id
Optional. Specify the IP Address, root password, SSH Port, SSH User, and password for this SSH User
Note: If one of our techs asks you for your root or application password, please use these parameters to send it via a secure way.
{
"replies":[{
"client_response": true,
"comment": "Test ticket comment",
"time": "2010-08-06T08:28:16-04:00"
}],
"subject": "Test Subject"
"status": "Open"
}
Where:
comment
time
client_response
{
"body": "This is a test reply body",
"root_password": "Ffe33D"
}
Where:
body
root_password
This will close the ticket.
Gets the list of Pro-Active Managed Services.
{
"managed_services":
[{
"virtual_machine_id": 520,
"managed_support_ip": "68.169.47.56",
"renewal_date": "11 Sep 2010"
}]
}
Gets the list of custom templates.
[{
"system_template":
{
"label": "test_cus_temp",
"operating_system": "Custom Templates",
"id": 115,
"description": "test_cus_temp"
}
}]
Edit custom template properties.
[{
"system_template":
{
"operating_system" : "Custom Template"
"description": "test_cus_temp"
"info": "This is a test info"
}
}]
This will remove the custom template straight away.
Gets the list of available templates.
[{
"template_groups": [
{
"name": "CentOS 5.5 x64",
"templates": [
{
"clouds": [
{
"id": 1
"system_template_id": 123
},
{
"id": 2
"system_template_id": 234
}
],
"name": "CentOS 5.5 x64 LAMP"
},
{
"clouds": [
{
"id": 3,
"system_template_id": 436
},
{
"id": 4,
"system_template_id": 516
}
],
"name": "CentOS 5.5 x64 MySQL"
}
]
}]
}]
{"system_template":
{
"label":"Windows Server 2008 x86 - Enterprise",
"os_type":"Windows",
"operating_system":"Windows",
"windows_license_version":"Enterprise",
"commercial":false,
"applicable_price":{"USD":20.0,"GBP":15},
"info":"Windows Server 2008 x86 - Enterprise",
"id":1899,
"description":"Windows Server 2008 x86 - Enterprise"
}
}
Please note that some templates like CloudLinux templates and Windows templates are chargeable. You should check for "applicable_price" parameter in this API call result to check if a particular template is chargeable.
Gets the list of CloudLinux templates.
[{
"commercial_template":
{
"system_template_id":106,
"id":25,
"virtual_machine_id":null
}
},
{
"commercial_template":
{
"system_template_id":107,
"id":27,
"virtual_machine_id":null
}
}]
{
"commercial_template":
{
"confirm_purchase": "1",
"system_template_id": "106",
}
}
{
"commercial_template":
{
"confirm_purchase": "1",
"system_template_id": "107"
}
}
Gets the list of Windows templates.
[{
"windows_template":
{
"system_template_id":10,
"id":15,
"virtual_machine_id":null
}
},
{
"windows_template":
{
"system_template_id":17,
"id":20,
"virtual_machine_id":null
}
}]
{
"windows_template":
{
"confirm_purchase": "1",
"system_template_id": "11",
}
}
{
"windows_template":
{
"confirm_purchase": "1",
"system_template_id": "12"
}
}
Gets the list of invoices.
[{
"invoice":
{
"date_sent":"2011-04-27T07:09:19-04:00",
"date_due":"2011-04-30T19:00:00-04:00",
"amount":"15.00",
"currency":"USD",
"status":"paid",
"invoice_no":"9130"
}
}]
Gets the current balance and account credits.
{
"current_balance":99.0,
"currency":"USD",
"account_credits":0
}
Get an Invoice in PDF format.
curl -C - -O -u dave@vps.net:abc123ABC456== -L https://api.vps.net/invoices/12345.pdf
Get user's profile information.