Syntax for Constructing a JSON File to Approve a Machine Request
You can specify a JSON file in your vRealize Automation REST API command line input. For example, when you enter a command to approve a machine request, you can include the name of a JSON file that contains all the parameters required to approve the request and complete the work item.
Template JSON File Values
Copy the following template to start constructing a properly formatted JSON file in a text editor. Replace the highlighted values with your obtained work item details. After you create the JSON file, you can include it, or its contents, when you approve a submitted machine request. See Syntax for Approving a Submitted Machine Request.
{ "formData": { "entries": [ { "key": "source-source-provider-Cafe.Shim.VirtualMachine.NumberOfInstances", "value": { "type": "integer", "value": 1 } }, { "key": "source-source-provider-VirtualMachine.Memory.Size", "value": { "type": "integer", "value": 512 } }, { "key": "source-source-provider-VirtualMachine.CPU.Count", "value": { "type": "integer", "value": 1 } }, { "key": "source-businessJustification", "value": { "type": "string", "value": "solves abx request" } }, { "key": "source-source-provider-VirtualMachine.LeaseDays", "value": { "type": "integer", "value": 0 } } ] }, "workItemId": "5e3e9519-78ea-4409-a52c-e4aa3bc56511", "workItemActionId": "com.mycompany.csp.core.approval.action.approve" }
Certain parameters are available to use in the JSON template.
JSON File Parameter Name | Description of Value |
---|---|
workItemId | Specifies the value of the corresponding work item ID obtained from the work item list. |
source-source-provider-Cafe.Shim.VirtualMachine.NumberOfInstances value | Specifies the number of instances requested. |
source-source-provider-VirtualMachine.Memory.Size | Specifies the amount of memory requested in GB. |
source-source-provider-VirtualMachine.CPU.Count | Specifies the number of CPUs requested. |
source-businessJustification | Specifies the text description of reason for request. |
source-source-provider-VirtualMachine.LeaseDays | Specifies the number of days to lease. |
workItemActionId |
To approve a request, include the approve statement, for example com.mycompany.csp.core.approval.action.approve.. To reject a request, include the reject statement, for example com.mycompany.csp.core.approval.action.reject. |
JSON Input File
Use the following JSON input file sample when constructing a file.
{ "@type": "CatalogItemRequest", "catalogItemRef": { "id": "65fbca06-a28e-46f3-bced-c6e5fb3a66f9" }, "organization": { "tenantRef": "MYCOMPANY", "subtenantRef": "cccd7a7e-5283-416b-beb0-45eb4e924dcb" }, "requestedFor": "[email protected]", "state": "SUBMITTED", "requestNumber": 0, "requestData": { "entries": [{ "key": "provider-blueprintId", "value": { "type": "string", "value": "e16edcf9-6a10-4bc7-98e2-a33361aeb857" } }, { "key": "provider-provisioningGroupId", "value": { "type": "string", "value": "cccd7a7e-5283-416b-beb0-45eb4e924dcb" } }, { "key": "requestedFor", "value": { "type": "string", "value": "[email protected]" } }, { "key": "provider-VirtualMachine.CPU.Count", "value": { "type": "integer", "value": 1 } }, { "key": "provider-VirtualMachine.Memory.Size", "value": { "type": "integer", "value": 1024 } }, { "key": "provider-VirtualMachine.LeaseDays", "value": { "type": "integer", "value": 30 } }, { "key": "provider-__Notes", "value": { "type": "string", "value": "MYCOMPANY machine" } }, { "key": "provider-VirtualMachine.Disk0.Size", "value": { "type": "string", "value": "1" } }, { "key": "provider-VirtualMachine.Disk0.Letter", "value": { "type": "string", "value": "C" } }, { "key": "provider-VirtualMachine.Disk0.Label", "value": { "type": "string", "value": "main" } }] } }