API to pull completed workItems including value of entitlement

Trying to generate completed task report via an API instead of dashboard csv task download as shown in picture.

I was expecting to see the highlighted items as shown in picture below which was downloaded from first picture

I have used API to pull the completed work item “{{baseUrl}}/v2024/work-items/completed“. However, it does not allow me to get all the details as highlighted in picture 2.

Is there a way for me to get the details as shown in 2nd picture using an API? Or the only choice I have to get a report is by downloading from the dashboard as shown in picture “1”?

You need to use 2 API calls assuming you are using some programing language to achieve this.

  1. Get the Completed Work Items list: This you already doing it by using get-completed-work-items | SailPoint Developer Community

  2. Iterate each Completed Work Item: You need to iterate each item from the response you are getting in step 1 by adding a loop and call another API get-work-item | SailPoint Developer Community by passing each workItem’s ID as a parameter to get the other required details.
    Below is the sample response of the API used in #2.

    {
      "id": "2c9180835d2e5168015d32f890ca1581",
      "requesterId": "2c9180835d2e5168015d32f890ca1581",
      "requesterDisplayName": "John Smith",
      "ownerId": "2c9180835d2e5168015d32f890ca1581",
      "ownerName": "Jason Smith",
      "created": "2017-07-11T18:45:37.098Z",
      "modified": "2018-06-25T20:22:28.104Z",
      "description": "Create account on source 'AD'",
      "state": "Finished",
      "type": "Generic",
      "remediationItems": [
        {
          "id": "2c9180835d2e5168015d32f890ca1581",
          "targetId": "2c9180835d2e5168015d32f890ca1581",
          "targetName": "john.smith",
          "targetDisplayName": "emailAddress",
          "applicationName": "Active Directory",
          "attributeName": "phoneNumber",
          "attributeOperation": "update",
          "attributeValue": "512-555-1212",
          "nativeIdentity": "jason.smith2"
        }
      ],
      "approvalItems": [
        {
          "id": "2c9180835d2e5168015d32f890ca1581",
          "account": "john.smith",
          "application": "Active Directory",
          "name": "emailAddress",
          "operation": "update",
          "value": "a@b.com",
          "state": "Pending"
        }
      ],
      "name": "Account Create",
      "completed": "2018-10-19T13:49:37.385Z",
      "numItems": 19,
      "form": {
        "id": "2c9180835d2e5168015d32f890ca1581",
        "name": "AccountSelection Form",
        "title": "Account Selection for John.Doe",
        "subtitle": "Please select from the following",
        "targetUser": "Jane.Doe",
        "sections": [
          {
            "name": "Field1",
            "label": "Section 1",
            "formItems": []
          }
        ]
      },
      "errors": [
        "The work item ID that was specified was not found."
      ]
    }
    

    Hope this helps you.

  3. Finally, you need to bind the data from both the responses and populate it as output like data table and export to required file format.

Thank you, Suresh, for a detail explanation. In my case I’m trying to pull completed workitem instead of active or pending. Any suggestions to pull via API in this case?

Now I understand what is going on. After I did some hands on in my side, the Work-item API does not return the completed work item and it is not mentioned in the API documentation apart from the state values which shows the Finished state as possible value. Unfortunately I’m not seeing any other option.

Note: When I dig deep into the UI call, it calls the private API to get the completed work item details and getting the below response.

{
    "items": [
        {
            "id": "2c9180835d2e5168015d32f890ca1581",
            "requester": "John Smith",
            "targetClass": "sailpoint.object.Identity",
            "targetId": "7991da301dd010399882a02f4b150684",
            "ownerId": null,
            "ownerName": "Jason Smith",
            "targetName": ""john.smith",
            "targetDisplayName": null,
            "targetDescription": null,
            "created": 1689858155713,
            "modified": 1756331219544,
            "description": "Create account on source 'AD",
            "type": "Generic",
            "state": "Finished",
            "approvalSet": {
                "items": [
                    {
                        "id": "2c9180835d2e5168015d32f890ca1581",
                        "application": "Active Directory",
                        "account": "john.smith",
                        "operation": "update",
                        "displayName": null,
                        "name": "emailAddress",
                        "displayValue": null,
                        "value": "a@b.com",
                        "state": "Finished"
                    }
                ]
            },
            "level": "Normal",
            "complete": true,
            "createdSinceMillis": 66535302014,
            "modifiedSinceMillis": 62238183,
            "remediationItems": null,
            "requesterDisplayName": "John Smith",
            "comments": [],
            "form": null
        }
    ],
    "count": 1
}

I wish they could allow the API to return the completed work item also.

Thank You for going into details.