POST /api/reservations with a reservationTypeID for vSphere, creates a vSphere reservation.

Input

Use the supported input parameters to control the command output.

Input

Description

URL

https://$vRA/reservation-service/api/reservations

Method

Post

$vRA

Specifies the appliance name and fully qualified domain name, or IP address of the vRealize Automation server.

$token

Specifies a valid HTTP bearer token with necessary credentials.

HTTP body

The HTTP body describes the reservation to create and calls the REST API used to create the reservation.

Compose the HTTP body using one of the following methods:

  • Copy the HTTP body from the JSON output from this example and edit the applicable field values to compose the HTTP body input for the command line.

  • Use the API commands in Syntax for Verifying a Reservation and Getting Reservation Details, remove the appropriate ID field from the HTTP response, and edit the field values to compose the HTTP body input for the command line.

Output

The output URL contains the new reservation ID.

Property

Description

status

When the reservation is successfully created, the HTTP response status is 201 created.

Header.Location

The HTTP response contains a Location attribute that is formatted as https://$vRA /reservation-service/api/reservations/$reservationId.

$reservationId

Specifies the new reservation ID.

curl Command

The following sample command creates a vSphere reservation. The HTTP body is included as part of the command line input.

curl -X POST --insecure -H "Accept:application/json" 
-H "Authorization: Bearer $token" 
https://$vRA/reservation-service/api/reservations -d 
“
{
  "name": "TestCreateReservation",
  "reservationTypeId": "Infrastructure.Reservation.Virtual.vSphere",
  "tenantId": "qe",
  "subTenantId": "ef58f604-528d-4441-a219-4725bead629b",
  "enabled": true,
  "priority": 3,
  "reservationPolicyId": "b71c3a5f-087a-4d9e-9a56-fab785a3d128",
  "alertPolicy": {
    "enabled": true,
    "frequencyReminder": 20,
    "emailBgMgr": false,
    "recipients": ["test1@mycompany.com",
    "test2@mycompany.com"],
    "alerts": [{
      "alertPercentLevel": 10,
      "referenceResourceId": "storage",
      "id": "storage"
    },
    {
      "alertPercentLevel": 20,
      "referenceResourceId": "memory",
      "id": "memory"
    },
    {
      "alertPercentLevel": 30,
      "referenceResourceId": "cpu",
      "id": "cpu"
    },
    {
      "alertPercentLevel": 40,
      "referenceResourceId": "machine",
      "id": "machine"
    }]
  },
  "extensionData": {
    "entries": [{
      "key": "reservationNetworks",
      "value": {
        "type": "multiple",
        "elementTypeId": "COMPLEX",
        "items": [{
          "type": "complex",
          "componentTypeId": "com.mycompany.csp.iaas.blueprint.service",
          "componentId": null,
          "classId": "reservationNetwork",
          "typeFilter": null,
          "values": {
            "entries": [{
              "key": "reservationNetworkPath",
              "value": {
                "type": "entityRef",
                "componentId": null,
                "classId": "Network",
                "id": "44cb65d5-b321-43dd-a2ab-8ecf387bff8f",
                "label": "VM Network SQA"
              }
            }]
          }
        }]
      }
    },
    {
      "key": "custom-Properties-key0",
      "value": {
        "type": "string",
        "value": "custom-property-value0"
      }
    },
    {
      "key": "custom-Properties-key2",
      "value": {
        "type": "string",
        "value": "custom-property-value2"
      }
    },
    {
      "key": "reservationMemory",
      "value": {
        "type": "complex",
        "componentTypeId": "com.mycompany.csp.iaas.blueprint.service",
        "componentId": null,
        "classId": "reservationMemory",
        "typeFilter": null,
        "values": {
          "entries": [{
            "key": "hostMemoryTotalSizeMB",
            "value": {
              "type": "integer",
              "value": 57187
            }
          },
          {
            "key": "memoryReservedSizeMb",
            "value": {
              "type": "integer",
              "value": 15872
            }
          }]
        }
      }
    },
    {
      "key": "computeResource",
      "value": {
        "type": "entityRef",
        "componentId": null,
        "classId": "ComputeResource",
        "id": "cc254a84-95b8-434a-874d-bdfef8e8ad2c",
        "label": "NSX61-RC-ComputeClusterA"
      }
    },
    {
      "key": "machineQuota",
      "value": {
        "type": "integer",
        "value": 2
      }
    },
    {
      "key": "reservationStorages",
      "value": {
        "type": "multiple",
        "elementTypeId": "COMPLEX",
        "items": [{
          "type": "complex",
          "componentTypeId": "com.mycompany.csp.iaas.blueprint.service",
          "componentId": null,
          "classId": "reservationStorage",
          "typeFilter": null,
          "values": {
            "entries": [{
              "key": "storageTotalSizeGB",
              "value": {
                "type": "integer",
                "value": 394
              }
            },
            {
              "key": "storageReservedSizeGB",
              "value": {
                "type": "integer",
                "value": 32
              }
            },
            {
              "key": "storageEnabled",
              "value": {
                "type": "boolean",
                "value": true
              }
            },
            {
              "key": "reservationStoragePath",
              "value": {
                "type": "entityRef",
                "componentId": null,
                "classId": "StoragePath",
                "id": "f48a527b-30a6-4d54-8829-f549bc195b69",
                "label": "VNXe:qe-vnxe-nfs-1"
              }
            },
            {
              "key": "storageFreeSizeGB",
              "value": {
                "type": "integer",
                "value": 120
              }
            },
            {
              "key": "storagePriority",
              "value": {
                "type": "integer",
                "value": 1
              }
            }]
          }
        }]
      }
    },
    {
      "key": "resourcePool",
      "value": {
        "type": "entityRef",
        "componentId": null,
        "classId": "ResourcePools",
        "id": "4e51fabc-19e8-4e79-b413-d52309b3bb62",
        "label": "CoreDev"
      }
    }]
  }
}
”

JSON Output

The following sample location URL is displayed, including the new vSphere reservation ID.

Location: 
https://$vRA/reservation-service/api/reservations/94d74105-831a-4598-8f42-efd590fea15c

Copy the output response into an XML editor for use in a future procedure, such as updating or deleting the reservation.