You can use the vRealize Automation REST API workitem service to list the unique IDs of all available work items.

Inputs

Use the supported input parameters to control the command output.

Parameter

Description

URL

https://$host/workitem-service/api/workitems

$host

Specifies the host name and fully qualified domain name or IP address of the vRealize Automation identity server.

$token

Specifies a valid HTTP bearer token with necessary credentials.

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.

    • 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 all the available work item IDs.

curl --insecure -H "Content-Type: application/json" 
-H "Authorization: Bearer $token” 
https://$host/workitem-service/api/workitems

JSON Output

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

{
  "links" : [ ],
  "content" : [ {
    "@type" : "WorkItem",
    "id" : "1755ef1a-d6f0-4901-9ecd-d03352ae4a05",
    "version" : 1,
    "workItemNumber" : 1,
    "assignees" : [ {
      "principalId" : "tony@example.mycompany.com",
      "principalType" : "USER"
    } ],
    "tenantId" : "MYCOMPANY",
    "callbackEntityId" : "1",
    "workItemType" : {
      "id" : "com.mycompany.cafe.samples.travel.workItem",
      "name" : "Workspace Assignment",
      "pluralizedName" : "Workspace Assignments",
      "description" : "Location Specific Workspace Assignment",
      "serviceTypeId" : "com.mycompany.cafe.samples.travel.api",
      "actions" : [ {
        "id" : "com.mycompany.cafe.samples.travel.workItem.complete",
        "name" : "Reserve Workspace",
        "stateName" : "Completed",
        "icon" : {
          "id" : "baa623db-0ca0-4db7-af41-9a301bc9e152",
          "name" : "Complete Action Icon",
          "contentType" : "image/png",
          "image" : null
        }
      }, {
        "id" : "com.mycompany.cafe.samples.travel.workItem.cancel",
        "name" : "Workspace Unavailable",
        "stateName" : "Cancelled",
        "icon" : {
          "id" : "b03f994a-e1ec-4aae-8fae-e747ed680a5e",
          "name" : "Cancel Action Icon",
          "contentType" : "image/png",
          "image" : null
        }
      } ],
      "completeByEmail" : true,
      "commentsField" : null,
      "listView" : {
        "columns" : [ {
          "id" : "duration",
          "label" : "Duration",
          "description" : "The length of stay, measured in days.",
          "dataType" : {
            "type" : "primitive",
            "typeId" : "INTEGER"
          },
          "displayAdvice" : null,
          "state" : {
            "dependencies" : [ ],
            "facets" : [ ]
          },
          "filterable" : false,
          "sortable" : false,
          "isMultiValued" : false
        }, {
          "id" : "location",
          "label" : "Destination",
          "description" : "The destination to which travel is being requested.",
          "dataType" : {
            "type" : "ref",
            "componentTypeId" : null,
            "componentId" : null,
            "classId" : "location",
            "typeFilter" : null,
            "label" : null
          },
          "displayAdvice" : null,
          "state" : {
            "dependencies" : [ ],
            "facets" : [ ]
          },
          "filterable" : false,
          "sortable" : false,
          "isMultiValued" : false
        }, {
          "id" : "arrivalDate",
          "label" : "Arrival Date",
          "description" : "The date of arrival at the destination",
          "dataType" : {
            "type" : "primitive",
            "typeId" : "DATE_TIME"
          },
          "displayAdvice" : null,
          "state" : {
            "dependencies" : [ ],
            "facets" : [ ]
          },
          "filterable" : false,
          "sortable" : false,
          "isMultiValued" : false
        } ],
        "defaultSequence" : [ "location", "arrivalDate", "duration" ]
      },
      "version" : 3,
      "forms" : {
        "workItemDetails" : {
          "type" : "external",
          "formId" : "travel.seating.task"
        },
        "workItemSubmission" : {
          "type" : "external",
          "formId" : "travel.seating.task"
        },
        "workItemNotification" : {
          "type" : "external",
          "formId" : "travel.itinerary.details"
        }
      }
    },

            .
            .
            .


    "completedDate" : null,
    "assignedDate" : "2014-02-20T23:55:31.600Z",
    "createdDate" : "2014-02-20T23:55:31.600Z",
    "assignedOrCompletedDate" : "2014-02-20T23:55:31.600Z",
    "serviceId" : "2af18227-6a00-49e9-a76b-96de3ee767d2",
    "workItemRequest" : {
      "itemId" : "531660fd-b540-4946-9917-38c023b61c02",
      "itemName" : "test travel 1",
      "itemDescription" : "test travel 1",
      "itemRequestor" : "tony@example.mycompany.com",
      "itemCost" : 0.0,
      "itemData" : {
        "entries" : [ {
          "key" : "requestLeaseTotal",
          "value" : {
            "type" : "money",
            "currencyCode" : null,
            "amount" : 1065.0
          }
        }, {
          "key" : "approvalId",
          "value" : {
            "type" : "string",
            "value" : "7a8b6054-1922-4f82-9266-245dffaa957c"
          }
        }, {
          "key" : "requestClassId",
          "value" : {
            "type" : "string",
            "value" : "request"
          }
        }, {
          "key" : "requestedFor",
          "value" : {
            "type" : "string",
            "value" : "tony@example.mycompany.com"
          }
        }, {
          "key" : "requestReasons"
        }, {
          "key" : "requestedItemName",
          "value" : {
            "type" : "string",
            "value" : "test travel 1"
          }
        }, {
          "key" : "requestInstanceId",
          "value" : {
            "type" : "string",
            "value" : "1cfe7177-74e3-4d68-a559-ea17587022ca"
          }
        }, {
          "key" : "requestRef",
          "value" : {
            "type" : "string",
            "value" : "15"
          }
        }, {
          "key" : "requestedItemDescription",
          "value" : {
            "type" : "string",
            "value" : "test travel 1"
          }
        }, {
          "key" : "requestLeaseRate",
          "value" : {
            "type" : "moneyTimeRate",
            "cost" : {
              "type" : "money",
              "currencyCode" : null,
              "amount" : 213.0
            },
            "basis" : {
              "type" : "timeSpan",
              "unit" : "DAYS",
              "amount" : 1
            }
          }
        }, {
          "key" : "requestingServiceId",
          "value" : {
            "type" : "string",
            "value" : "f91d044a-04f9-4b96-8542-375e3e4e1dc1"
          }
        }, {
          "key" : "policy",
          "value" : {
            "type" : "string",
            "value" : "test travel approval policy"
          }
        }, {
          "key" : "phase",
          "value" : {
            "type" : "string",
            "value" : "Pre Approval"
          }
        }, {
          "key" : "requestDescription",
          "value" : {
            "type" : "string",
            "value" : "t"
          }
        }, {
          "key" : "requestLease",
          "value" : {
            "type" : "timeSpan",
            "unit" : "DAYS",
            "amount" : 5
          }
        }, {
          "key" : "requestedBy",
          "value" : {
            "type" : "string",
            "value" : "tony@example.mycompany.com"
          }
        } ]
      }
    },
    "status" : "Active",
    "availableActions" : [ ]
  } ],
  "metadata" : {
    "size" : 20,
    "totalElements" : 7,
    "totalPages" : 1,
    "number" : 1,
    "offset" : 0
  }
}