Difference between revisions of "API"
(→Action list) |
|||
Line 91: | Line 91: | ||
|list | |list | ||
|None | |None | ||
+ | |None | ||
+ | |} | ||
+ | |||
+ | === DNS === | ||
+ | |||
+ | API calls relating to DNS are listed below. Valid DNS record types are 'A', 'AAAA', 'CNAME', 'HINFO', 'MX', 'NAPTR', 'NS', 'PTR', 'RP', 'SRV', and 'TXT'. | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Category | ||
+ | ! Action | ||
+ | ! Required parameters | ||
+ | ! Optional parameters | ||
+ | |- | ||
+ | |dns | ||
+ | |list | ||
+ | |None | ||
+ | |None | ||
+ | |- | ||
+ | |dns | ||
+ | |set | ||
+ | |vm_id, ip, hostname | ||
+ | |None | ||
+ | |- | ||
+ | |dns | ||
+ | |zone-list | ||
+ | |None | ||
+ | |None | ||
+ | |- | ||
+ | |dns | ||
+ | |zone-add | ||
+ | |origin (e.g., 'example.tld.') | ||
+ | |ttl | ||
+ | |- | ||
+ | |dns | ||
+ | |zone-remove | ||
+ | |zone_id | ||
+ | |None | ||
+ | |- | ||
+ | |dns | ||
+ | |record-list | ||
+ | |zone_id | ||
+ | |None | ||
+ | |- | ||
+ | |dns | ||
+ | |record-add | ||
+ | |zone_id, name (e.g., 'www'), data (e.g., '1.2.3.4'), ttl, type | ||
+ | |None | ||
+ | |- | ||
+ | |dns | ||
+ | |record-remove | ||
+ | |record_id | ||
+ | |None | ||
+ | |- | ||
+ | |dns | ||
+ | |dyn-list | ||
+ | |None | ||
+ | |None | ||
+ | |- | ||
+ | |dns | ||
+ | |dyn-add | ||
+ | |name, ip | ||
+ | |None | ||
+ | |- | ||
+ | |dns | ||
+ | |dyn-update | ||
+ | |dyn_id, name, ip | ||
+ | |None | ||
+ | |- | ||
+ | |dns | ||
+ | |dyn-remove | ||
+ | |dyn_id | ||
+ | |None | ||
+ | |} | ||
+ | |||
+ | === Image === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Category | ||
+ | ! Action | ||
+ | ! Required parameters | ||
+ | ! Optional parameters | ||
+ | |- | ||
+ | |image | ||
+ | |list | ||
+ | |None | ||
+ | |region (default 'toronto') | ||
+ | |- | ||
+ | |image | ||
+ | |delete | ||
+ | |image_id | ||
+ | | | ||
+ | |- | ||
+ | |image | ||
+ | |create | ||
+ | |vm_id, name | ||
+ | |None | ||
+ | |} | ||
+ | |||
+ | <h4>Plan and region</h4> | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Category | ||
+ | ! Action | ||
+ | ! Required parameters | ||
+ | ! Optional parameters | ||
+ | |- | ||
+ | |plan | ||
+ | |list | ||
+ | |None | ||
+ | |None | ||
+ | |- | ||
+ | |region | ||
+ | |list | ||
+ | |None | ||
+ | |None | ||
+ | |} | ||
+ | |||
+ | === Server monitoring === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! Category | ||
+ | ! Action | ||
+ | ! Required parameters | ||
+ | ! Optional parameters | ||
+ | |- | ||
+ | |monitor | ||
+ | |check-list | ||
+ | |None | ||
+ | |None | ||
+ | |- | ||
+ | |monitor | ||
+ | |check-types | ||
+ | |None | ||
+ | |None | ||
+ | |- | ||
+ | |monitor | ||
+ | |check-add | ||
+ | |name, type, fail_count, success_count, check_interval, (also any parameters needed from check-types) | ||
+ | |None | ||
+ | |- | ||
+ | |monitor | ||
+ | |check-remove | ||
+ | |check_id | ||
+ | |None | ||
+ | |- | ||
+ | |monitor | ||
+ | |contact-list | ||
+ | |None | ||
+ | |None | ||
+ | |- | ||
+ | |monitor | ||
+ | |contact-add | ||
+ | |None | ||
+ | |None | ||
+ | |- | ||
+ | |monitor | ||
+ | |contact-remove | ||
+ | |type ('email', 'sms_twilio', or 'http'), rel (e-mail address, phone number, or URL) | ||
+ | |None | ||
+ | |- | ||
+ | |monitor | ||
+ | |alert-list | ||
+ | |check_id | ||
+ | |None | ||
+ | |- | ||
+ | |monitor | ||
+ | |alert-add | ||
+ | |check_id, contact_id | ||
+ | |None | ||
+ | |- | ||
+ | |monitor | ||
+ | |alert-remove | ||
+ | |alert_id | ||
|None | |None | ||
|} | |} |
Revision as of 00:12, 14 December 2014
The Luna Node Dynamic API enables you to write software to automate VM management. This page details how the API can be accessed. Visit the API tab to manage your API keys.
Contents
Overview
Each API token consists of an API ID and an API key. Both are needed for authentication of all API commands.
API actions consist of a category label, action label, and a set of parameters. For example, to start a VM, the category label is "vm", action label is "start", and a "vm_id" parameter must be set. See the full API action list.
API requests are made over HTTPS. Once the server completes processing of your request, it will return a JSON-encoded response.
Usage
Action list
Virtual machine
Category | Action | Required parameters | Optional parameters |
---|---|---|---|
vm | start | vm_id | None |
vm | stop | vm_id | None |
vm | reboot | vm_id | None |
vm | info | vm_id | None |
vm | delete | vm_id | None |
vm | setpassword | vm_id, password | None |
vm | reimage | vm_id, image_id | None |
vm | resize | vm_id, plan_id | None |
vm | rescue | vm_id | None |
vm | vnc | vm_id | None |
vm | floatingip-add | vm_id | ip (string unattached floating IP address on your account) |
vm | floatingip-delete | vm_id | keep ('yes' to keep floating IP on account; default 'no') |
vm | create | hostname, plan_id, image_id | prefer ('distinct' or 'same'), region (default 'toronto'), ip (a floating IP on your account) |
vm | list | None | None |
DNS
API calls relating to DNS are listed below. Valid DNS record types are 'A', 'AAAA', 'CNAME', 'HINFO', 'MX', 'NAPTR', 'NS', 'PTR', 'RP', 'SRV', and 'TXT'.
Category | Action | Required parameters | Optional parameters |
---|---|---|---|
dns | list | None | None |
dns | set | vm_id, ip, hostname | None |
dns | zone-list | None | None |
dns | zone-add | origin (e.g., 'example.tld.') | ttl |
dns | zone-remove | zone_id | None |
dns | record-list | zone_id | None |
dns | record-add | zone_id, name (e.g., 'www'), data (e.g., '1.2.3.4'), ttl, type | None |
dns | record-remove | record_id | None |
dns | dyn-list | None | None |
dns | dyn-add | name, ip | None |
dns | dyn-update | dyn_id, name, ip | None |
dns | dyn-remove | dyn_id | None |
Image
Category | Action | Required parameters | Optional parameters |
---|---|---|---|
image | list | None | region (default 'toronto') |
image | delete | image_id | |
image | create | vm_id, name | None |
Plan and region
Category | Action | Required parameters | Optional parameters |
---|---|---|---|
plan | list | None | None |
region | list | None | None |
Server monitoring
Category | Action | Required parameters | Optional parameters |
---|---|---|---|
monitor | check-list | None | None |
monitor | check-types | None | None |
monitor | check-add | name, type, fail_count, success_count, check_interval, (also any parameters needed from check-types) | None |
monitor | check-remove | check_id | None |
monitor | contact-list | None | None |
monitor | contact-add | None | None |
monitor | contact-remove | type ('email', 'sms_twilio', or 'http'), rel (e-mail address, phone number, or URL) | None |
monitor | alert-list | check_id | None |
monitor | alert-add | check_id, contact_id | None |
monitor | alert-remove | alert_id | None |