Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Children Display
alltrue
styleh3
pageSuperb Cloud API

POST /virtual_machines/:virtual_machine_id/build 

Build or re-build a VM

Sections:

Table of Contents
maxLevel4
minLevel2
includeResponse.*|JSON.*|XML.*

Request Parameters

template_id* - the ID of a template from which a VS should be built.

required_startup - set to 1 if you wish to start a VS after it is built. Otherwise set to 0.

 
Instead of virtual server ID (:virtual_machine_id) you may use virtual server identifier (:virtual_machine_identifier).

initial_root_password_encryption_key -  specify the password encryption passphrase

Response Parameters

Info
On success response is 201 status and virtual machine object.

JSON Request example

Code Block
languagebash
themeRDark
 curl -i -X POST -H 'Accept: application/json' -H 'Content-type: application/json' -u user:userpass -d '{"virtual_machine":{"template_id":"1","required_startup":"1"}}' --url <api_url>/virtual_machines/:virtual_machine_id/build.json

JSON Response

Code Block
themeRDark
 {
    "virtual_machine": {
        "add_to_marketplace": null,
        "admin_note": null,
        "allowed_hot_migrate": true,
        "allowed_swap": true,
        "booted": false,
        "built": false,
        "cores_per_socket": 0,
        "cpu_shares": 1,
        "cpu_sockets": null,
        "cpu_threads": null,
        "cpu_units": 10,
        "cpus": 1,
        "created_at": "2015-08-25T21:52:34+00:00",
        "customer_network_id": null,
        "deleted_at": null,
        "edge_server_type": null,
        "enable_autoscale": null,
        "enable_monitis": null,
        "firewall_notrack": false,
        "hostname": "zaza",
        "hypervisor_id": 12,
        "id": 502,
        "identifier": "abcde224e600fv",
        "initial_root_password_encrypted": false,
        "iso_id": null,
        "label": "zaza",
        "local_remote_access_ip_address": "192.168.0.1",
        "local_remote_access_port": null,
        "locked": true,
        "memory": 20000,
        "min_disk_size": 5,
        "note": null,
        "operating_system": "linux",
        "operating_system_distro": "lbva",
        "preferred_hvs": [
            11,
            12,
            5,
            10,
            4
        ],
        "recovery_mode": null,
        "remote_access_password": "password",
        "service_password": null,
        "state": "failed",
        "storage_server_type": null,
        "strict_virtual_machine_id": null,
        "suspended": false,
        "template_id": 10,
        "template_label": "Load Balancer Virtual Appliance",
        "updated_at": "2015-08-26T18:43:18+00:00",
        "user_id": 123,
        "vip": null,
        "xen_id": null,
        "ip_addresses": [
            {
                "ip_address": {
                    "address": "192.168.0.1",
                    "broadcast": "192.168.0.1",
                    "created_at": "2015-07-30T01:35:54+00:00",
                    "customer_network_id": null,
                    "disallowed_primary": false,
                    "gateway": "66.148.116.1",
                    "hypervisor_id": null,
                    "id": 1667,
                    "ip_address_pool_id": null,
                    "network_address": "192.168.0.1",
                    "network_id": 1,
                    "pxe": false,
                    "updated_at": "2015-08-25T21:52:34+00:00",
                    "user_id": null,
                    "free": false,
                    "netmask": "255.255.252.0"
                }
            }
        ],
        "monthly_bandwidth_used": "0",
        "total_disk_size": 26,
        "price_per_hour": 0.28557783000000003,
        "price_per_hour_powered_off": 0.007083389999999999,
        "support_incremental_backups": true,
        "cpu_priority": 1
    }
}

XML Request example

Code Block
languagebash
themeRDark
 curl -i -X POST -H 'Accept: application/xml' -H 'Content-type: application/xml' -u user:userpass -d '<?xml version="1.0" encoding="UTF-8"?><virtual_machine><template_id>1</template_id><required_startup>1</required_startup></virtual_machine>' --url <api_url>/virtual_machines/:virtual_machine_id/build.xml