Get Workflow Step History Records

The Luma Automation API ‘WorkflowStepHistory’ is used to get the list of workflow steps executed as part of the Luma Automation workflow. Based on the Workflow Trigger ID, the web service fetches details such as Step name, Step ID, Initiation time, completion time, History ID, etc for each step in the workflow. The API uses the trigger ID as the input parameter and returns the list of workflow steps as a response in JSON format. You can filter the workflow steps based on information such as execution status or sort the records based on details such as execution start time or end time.

Use the following details to configure API:

  1. Capture the tenant access token created during the Automation tenant provisioning. This token is sent as the Header to the API. Header → itas-api-access-key: <Tenant Access Token>.
    You can also use Regenerate Tenant Access Token API to regenerate and fetch the tenant access token.

  2. URI: /gateway/api/v1/workflowhistory/<Trigger ID>/stephistory
    The Trigger ID is generated when the Workflow is Automation Workflow is triggered.
    For example, api/v1/workflowhistory/d9bf533e-cc29-4efe-a0e7-df4aef85cbc0/stephistory

  3. HTTP Method for the operation: GET

  4. Pass the following as Query Parameters to the Web Service:

    1. filter - Use the execution Status to filter the workflow steps. For example, you may use status ==FAILED.

    2. orderBy - Use the orderby parameter to sort the information. Use the field name and sorting order. For Example, You may use ‘startTime asc' to sort the workflow steps in ascending order, based on the workflow step initiation time.

    3. skip- 0

    4. top - 10

  5. As a response, the web service fetches the detailed information of the steps executed as part of the workflow. Response from the web service is received in the following format:

    { "status": "Success", "statusCode": 0, "statusLine": "Successfully retrieved workflow step history records.", "errors": null, "resultData": [ { "activityName": "Start - Send SMS to User", // Step Name "activityId": "StartEvent_1", // Step Identifier "activityType": "startEvent", // Step Type "startTime": 1641823983804, "endTime": 1641823983825, "status": "COMPLETED", "totalAttempts": 1, // Applicable in case the step is retried on failure "timeSpent": 21, "href": "/api/v1/workflowStepHistory/799", "id": 799 // Step History ID will be used to retrieve detailed information of the step, i.e. trace log, runtime info etc. }, { "activityName": "get user", "activityId": "Activity_0onlkqz", "activityType": "serviceTask", "startTime": 1641823983894, "endTime": 1641823986906, "status": "COMPLETED", "totalAttempts": 1, "timeSpent": 3012, "href": "/api/v1/workflowStepHistory/800", "id": 800 }, { "activityName": "Is Mobile Number Found?", "activityId": "Gateway_08bods4", "activityType": "exclusiveGateway", "startTime": 1641823987175, "endTime": 1641823987245, "status": "COMPLETED", "totalAttempts": 1, "timeSpent": 70, "href": "/api/v1/workflowStepHistory/801", "id": 801 }, { "activityId": "Flow_0gxy3b7", "activityType": "sequenceFlow", "startTime": 1641823987283, "endTime": 1641823987283, "status": "COMPLETED", "totalAttempts": 1, "timeSpent": 0, "href": "/api/v1/workflowStepHistory/802", "id": 802 }, { "activityName": "send sms", "activityId": "Activity_send_sms_0jpnuna", "activityType": "serviceTask", "startTime": 1641823987411, "endTime": 1641823988879, "status": "FAILED", "totalAttempts": 1, "timeSpent": 1468, "href": "/api/v1/workflowStepHistory/803", "id": 803 } ], "warnings": [], "timestamp": 1641880297337, "reasonPhrase": null, "metaInfo": { "totalRecordCount": 5, "currentRecordCount": 5 } }
    1. ‘status’ represents the execution status of the web service call. Success represents that the web service operation was successfully executed.

    2. ‘statusCode’ represents the status code.

    3. ‘statusLine’ represents the response message received from the web service. The message "Successfully retrieved workflow step history records." represents that the web service has successfully returned information for the steps executed as part of the workflow.

    4. ‘errors’ indicate the error received in case the web service execution fails.

    5. ‘resultData’ section contains the execution details of each workflow step. The following details are received for each workflow step:

      1. activityName represents the Workflow Step name.

      2. activityId is the Workflow Step Identifier in Luma Automation

      3. activityType represents the type of activity executed at the step. For example, StartEvent, EndEvent, ServiceTask etc.

      4. startTime represents the workflow step initiation time (Epoch time).

      5. endTime represents the workflow step execution completion time (Epoch time)

      6. status indicates the current workflow execution status of the workflow step. For example, RUNNING, SUSPENDED, ACTIVATED, COMPLETED, FAILED, TERMINATED, etc.

      7. totalAttempts represents the number of execution attempts. This is applicable in case the step is retried on failure.

      8. timeSpent is the time spent in completing the workflow step execution.

      9. href contains the link to the Workflow execution history record.

      10. id is the Luma ID of the Automation Workflow execution history record. The Step History ID is used to retrieve detailed information of the step, i.e. trace log, runtime info, etc using Get Detailed Workflow Step History Record API.

    6. 'warnings’ field contains any warning received from web service execution.

    7. ‘timestamp’ represents the time (Epoch time) of web service execution.

    8. ‘reasonPhrase’ represents the error, in case web service execution fails.

    9. ‘metaInfo’ contains the result count. here we can see:

      • ‘totalRecordCount’ is the total number of Workflow step records returned by the Web Service.

      • ‘currentRecordCount’: In case, pagination is enabled, the API may not return all the records in the response. ‘currentRecordCount’ represents the count of records available in the current response.

Query Parameters skip and top are used for pagination. For example, to enable pagniation and fetch the first 10 records, use Skip =0 and Top = 10.