PUT /api/v3/envs

Adds one or more VMs to an existing environment

Request Path

PUT /api/v3/envs

Request Payload Example (using a CloudShare VM template)

{
    "envId": "EN5YTkVIYcD6kL9flyAAYyzg2",
    "itemsCart": [
        {
            "type": 2,
            "name": "VM Name",
            "description": "VM Description",
            "templateVmId": "VMyFyls16PYN0dZRUfYIqskA2"
        }
    ]
}

Request Payload Example (using a machine from an existing Snapshot)

{
    "envId": "EN5YTkVIYcD6kL9flyAAYyzg2",
    "itemsCart": [
        {
            "type": 4,
            "name": "VM Name",
            "description": "VM Description",
            "machineId": "MClp0Hlze4kWhoPALu9zsheg2",
            "disconnectedFromNetworks": false
        }
    ]
}

Parameters

envId The ID of the environment. To retrieve environment IDs, use GET /api/v3/envs.
itemsCart Specifies templates of VMs to add to the environment
itemsCart.type Specifies a type of item to add. Must be 2 (which denotes a VM from a VM template) or 4 (which denotes a machine from a snapshot).
itemsCart.name A name for the VM
itemsCart.description Optional. A description for the VM.
itemsCart.templateVmId The ID of the VM template from which to create the VM (must be provided when type == 2). To retrieve available VM templates, use GET /api/v3/templates.
itemsCart.machineId The ID of the Machine from which to create the VM (must be provided when type == 4). To retrieve available machines, use GET /api/v3/snapshots/ID.
itemsCart.disconnectedFromNetworks Set this to true if the Blueprint’s machine’s network configuration will conflict with the target Environment’s network configuration.

Response Example

{
    "resources": {
        "cpuCount": 2,
        "diskSizeMB": 24576,
        "memorySizeMB": 1024
    },
    "vms": [
        {
            "name": "VM Name",
            "description": "VM Description",
            "osTypeName": null,
            "imageUrl": "/ImageHandler.ashx?rXL5DH0iKAm9EtYscPdMAw2",
            "resources": {
                "cpuCount": 1,
                "diskSizeMB": 12288,
                "memorySizeMB": 512
            },
            "domainName": null,
            "internalIPs": [],
            "macAddresses": [],
            "canAddMultipleInstances": true,
            "hostName": null,
            "vanityName": null,
            "httpAccessEnabled": true,
            "startWithHttps": false,
            "user": "Administrator",
            "password": null,
            "id": "MCWDfD3slTbJNGl-MJEcPg7A2"
        },
        {
            "name": "VM Name 2",
            "description": "VM Description",
            "osTypeName": null,
            "imageUrl": "/ImageHandler.ashx?1YTwBlG87xLZFAtVPBGN_Q2",
            "resources": {
                "cpuCount": 1,
                "diskSizeMB": 12288,
                "memorySizeMB": 512
            },
            "domainName": null,
            "internalIPs": [],
            "macAddresses": [],
            "canAddMultipleInstances": true,
            "hostName": null,
            "vanityName": null,
            "httpAccessEnabled": false,
            "startWithHttps": false,
            "user": "Administrator",
            "password": null,
            "id": "MC0J5KBSmuDMJV0rQRvYiqfw2"
        }
    ],
    "environmentId": "ENrwmIocZbHiNDC1p4jLcNPA2"
}

Not all VM information is available at this stage, including password and hostName. To query environment VMs, use GET /api/v3/envs/actions/getextended.