Syntax for Getting Work Item Details

GET /api/workitems/{id} retrieves the details of a pending work item. You need these details to submit a completion request.

Input

Use the supported input parameters to control the command output.

Parameter Description
URL https://$vRA/workitem-service/api/workitems/workitem_ID
$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.

workitem_ID Specifies the unique identifier of a work item. See Syntax for Listing Work Items.

Output

The command output contains property names and values based on the command input parameters.

Property Description

Links

Specifies an array of link objects, each of which contains the following parts:
  • rel: Specifies the name of the link.
    • Self refers to the object that was returned or requested. This property does not exist when you query for a single profile.
    • First, Previous, Next, and Last refer to corresponding pages of pageable lists.
    • Specifies the application or service that determines the other names.
  • href: Specifies the URL that produces the result.
work itemNumber Displays a reference number for the work item.
id Specifies the unique identifier of this resource.
version Displays the object version number.
assignees Displays the list of work item assignees.
subTenantId Optionally associates the work item with a specific business group granting users with management responsibilities over that business group permission to see the approval.
tenantId Specifies the tenant ID for the work item.
callbackEntityId Specifies the callback entity ID for the work item.
work itemType Specifies the work item type for the work item.
completedDate Specifies the date when the work item was completed.
assignedDate Specifies the date when the work item was assigned.
createdDate Specifies the created date of this instance.
assignedOrCompletedDate Specifies the date to be displayed on UI.
formUrl Specifies the URL from which the layout for this work item can be retrieved.
serviceId Specifies the service ID that generated this work item instance.
work itemRequest Specifies the corresponding work item request object.
status Specifies the status of the work item.
completedBy Specifies the principal ID of user who completed the work item.
availableActions Contains a list of relevant work item actions.
Metadata Specifies the paging-related data:
  • Size: Specifies the maximum number of rows per page.
  • totalElement: Specifies the number of rows returned.
  • totalPages: Specifies the total number of pages of data available.
  • Number: Specifies the current page number.
  • Offset: Specifies the number of rows skipped.

curl Command

The following example command retrieves the necessary details for the specified work item.

curl --insecure -H "Content-Type: application/json" 
-H "Authorization: Bearer $token” 
https://$vRA/workitem-service/api/workitems/5e3e9519-78ea-4409-a52c-e4aa3bc56511

JSON Output

The following JSON output is returned based on the command input.

Note: Price is referred to as cost in API commands and output.

To view the contents of a JSON output file, for example workItemDetails.json, use the ! command with more in UNIX or type in Windows.

  • (UNIX) vcac-shell>! more workItemDetails.json
  • (Windows) vcac-shell> ! CMD /C type workItemDetails.json
vcac-shell>  ! more workItemDetails.json
{
  "id" : "5e3e9519-78ea-4409-a52c-e4aa3bc56511",
  "version" : 0,
  "workItemNumber" : 8,
  "assignees" : [ {
    "principalId" : "[email protected]",
    "principalType" : "USER"
  } ],
  "subTenantId" : "eab762cb-6e75-4379-83ef-171a71c9f00e",
  "tenantId" : "MYCOMPANY",
  "callbackEntityId" : "069dc3ce-a260-4d6a-b191-683141c994c0",
  "workItemType" : {
    "id" : "com.mycompany.csp.core.approval.workitem.request",
    "name" : "Approval",
    "pluralizedName" : "Approvals",
    "description" : "",
    "serviceTypeId" : "com.mycompany.csp.core.cafe.approvals",
    "actions" : [ {
      "id" : "com.mycompany.csp.core.approval.action.approve",
      "name" : "Approve",
      "stateName" : "Approved",
      "icon" : {
        "id" : "c192b6a7-5b35-4a3b-8593-107ffcf8c3a8",
        "name" : "approved.png",
        "contentType" : "image/png",
        "image" : null
      }
    }, {
      "id" : "com.mycompany.csp.core.approval.action.reject",
      "name" : "Reject",
      "stateName" : "Rejected",
      "icon" : {
        "id" : "61c6da67-1164-421d-b575-10a245c89e10",
        "name" : "rejected.png",
        "contentType" : "image/png",
        "image" : null
      }
    } ],
    "completeByEmail" : true,
    "commentsField" : "businessJustification",
    "listView" : {
      "columns" : [ {
        "id" : "requestedItemName",
        "label" : "Requested Item",
        "description" : "",
        "dataType" : {
          "type" : "primitive",
          "typeId" : "STRING"
        },
        "displayAdvice" : null,
        "state" : {
          "dependencies" : [ ],
          "facets" : [ ]
        },
        "filterable" : false,
        "sortable" : false,
        "isMultiValued" : false
      },

            .
            .
            .

       {
        "id" : "requestLease",
        "label" : "Lease",
        "description" : "",
        "dataType" : {
          "type" : "primitive",
          "typeId" : "TIME_SPAN"
        },
        "displayAdvice" : null,
        "state" : {
          "dependencies" : [ ],
          "facets" : [ ]
        },
        "filterable" : false,
        "sortable" : false,
        "isMultiValued" : false
      } ],
      "defaultSequence" : [ "requestRef", "requestedItemName", "requestedFor", "requestLease", "requestLeaseRate", "requestLeaseTotal" ]
    },
    "version" : 1,
    "forms" : {
      "workItemDetails" : {
        "type" : "external",
        "formId" : "approval.details"
      },
      "workItemSubmission" : {
        "type" : "external",
        "formId" : "approval.submission"
      },
      "workItemNotification" : {
        "type" : "external",
        "formId" : "approval.notification"
      }
    }
  },
  "completedDate" : null,
  "assignedDate" : "2014-02-25T01:26:07.153Z",
  "createdDate" : "2014-02-25T01:26:07.153Z",
  "assignedOrCompletedDate" : "2014-02-25T01:26:07.153Z",
  "serviceId" : "2af18227-6a00-49e9-a76b-96de3ee767d2",
  "workItemRequest" : {
    "itemId" : "069dc3ce-a260-4d6a-b191-683141c994c0",
    "itemName" : "test-blueprint",
    "itemDescription" : "",
    "itemRequestor" : "[email protected]",
    "itemCost" : 0.0,
    "itemData" : {
      "entries" : [ {
        "key" : "requestLeaseTotal"
      }, {
        "key" : "approvalId",
        "value" : {
          "type" : "string",
          "value" : "469c11ae-ed27-4790-baf1-c6839f35d474"
        }
      }, {
        "key" : "requestClassId",
        "value" : {
          "type" : "string",
          "value" : "request"
        }
      }, {
        "key" : "requestedFor",
        "value" : {
          "type" : "string",
          "value" : "[email protected]"
        }
      }, {
        "key" : "requestReasons",
        "value" : {
          "type" : "string",
          "value" : ""
        }
      }, {
        "key" : "requestedItemName",
        "value" : {
          "type" : "string",
          "value" : "test-blueprint"
        }

            .
            .
            .

      }, {
        "key" : "requestLease"
      }, {
        "key" : "requestedBy",
        "value" : {
          "type" : "string",
          "value" : "[email protected]"
        }
      } ]
    }
  },
  "status" : "Active",
  "availableActions" : [ ]
}