Requests task details using the API.

How to get task details via the API

Used for different use cases, like post-processing the data of an inspection task. It can be necessary to request this data from the Frontline Command Center. This page describes how this is done.

The first step is to look up what tasks have been done, to later get details about one of these. This is done as follows:

  1. Sign in via the API to the Frontline Command Center.
  2. Extract the token from the sign-in response and use it as Bearer Token for the next one.
  3. Create a GET request to https://my-address/wftasks/getTasksForDisplay.

The output will look like this:

{
  "content": [
    {
      "id": 1,
      "name": "test",
      "team": null,
      "teamId": null,
      "userId": 5,
      "userDisplayName": "Tester",
      "createdByUserDisplayName": "Tester",
      "status": "done",
      "createDate": "2021-07-01T19:53:19+02:00",
      "doneDate": "2021-07-01T19:53:53+02:00",
      "startDate": null,
      "datePlanned": "2021-07-01T19:53:19+02:00",
      "changeDate": null,
      "workflowDisplayName": "MyWorkflow",
      "workflowId": "313a1c3b-2d84-4197-9f63-20000d1d725f",
      "workflowVersion": "2",
      "taskResult": null,
      "version": null,
      "comment": null,
      "domain": "ubimax",
      "externalId": null,
      "commentsCount": 0,
      "mediasCount": 2,
      "duration": "00:34",
      "pdfReportingEnabled": true,
      "hideTaskDetails": false,
      "containsResult": true,
      "tags": []
    }
  ],
  "pageable": {
    "sort": {
      "sorted": false,
      "unsorted": true,
      "empty": true
    },
    "offset": 0,
    "pageNumber": 0,
    "pageSize": 20,
    "unpaged": false,
    "paged": true
  },
  "last": false,
  "totalElements": 67,
  "totalPages": 4,
  "size": 20,
  "number": 0,
  "sort": {
    "sorted": false,
    "unsorted": true,
    "empty": true
  },
  "first": true,
  "numberOfElements": 20,
  "empty": false
}

This is a list of the first 20 tasks which can also be seen on https://my-address/xinspect.html#!/tasks. The list can also be presorted by specifying it in the request URL. An example could look like this:

https://my-address/wftasks/getTasksForDisplay?page=0&size=20&sort=createDate,desc

The response would now be the 20 last tasks created.

To get more information about a specific task, we need to modify the request by adding the ID of the task:

https://192.168.2.116/wftasks/getTasksForDisplay?page=0&size=1&taskId=67&templates=false

The response would look like this:

{
  "content": [
    {
      "id": 67,
      "name": "TestDetails",
      "team": null,
      "teamId": null,
      "userId": 5,
      "userDisplayName": "Tester",
      "createdByUserDisplayName": "Tester",
      "status": "done",
      "createDate": "2021-08-12T14:17:48+02:00",
      "doneDate": "2021-08-12T14:18:32+02:00",
      "startDate": null,
      "datePlanned": "2021-08-12T14:17:48+02:00",
      "changeDate": null,
      "workflowDisplayName": "ImagesTaskDetails",
      "workflowId": "d0c95cb1-cadd-4518-b220-e0cdbedc8294",
      "workflowVersion": "1",
      "taskResult": {
        "id": 67,
        "workflowName": "ImagesTaskDetails",
        "stepID": null,
        "startTime": "2021-08-12T14:17:48+02:00",
        "endTime": "2021-08-12T14:18:30+02:00",
        "duration": "00:42",
        "status": "done",
        "workflowResultUUID": "8a7f5893-f1e3-4848-bbf0-387a26541238",
        "attachments": [],
        "stepResults": [
          {
            "id": 17971,
            "stepID": "component_documentation_1628601616736:take_picture",
            "name": "Documentation: Screen with camera for triggering a screenshot",
            "startTime": "2021-08-12T14:17:51+02:00",
            "endTime": "2021-08-12T14:18:06+02:00",
            "duration": "00:09",
            "status": "done",
            "workflowResultUUID": null,
            "attachments": [
              {
                "id": 72236,
                "type": "history",
                "changeDate": null,
                "payload": "[{\"event\":\"start\",\"time\":1628770671291},{\"event\":\"stop\",\"time\":1628770675399},{\"event\":\"start\",\"time\":1628770678364},{\"event\":\"stop\",\"time\":1628770681297},{\"event\":\"start\",\"time\":1628770683973},{\"event\":\"stop\",\"time\":1628770686833}]",
                "assetUri": null
              },
              {
                "id": 72237,
                "type": "visit_count",
                "changeDate": null,
                "payload": "3",
                "assetUri": null
              }
            ],
            "imagePaths": [],
            "documentationComments": [],
            "comment": null,
            "question": null,
            "answers": null,
            "questionTitle": null,
            "barcodeContent": null,
            "measurement": null
          },
          ...
  ],
  "pageable": {
    "sort": {
      "sorted": false,
      "unsorted": true,
      "empty": true
    },
    "offset": 0,
    "pageNumber": 0,
    "pageSize": 1,
    "unpaged": false,
    "paged": true
  },
  "last": true,
  "totalElements": 1,
  "totalPages": 1,
  "size": 1,
  "number": 0,
  "sort": {
    "sorted": false,
    "unsorted": true,
    "empty": true
  },
  "first": true,
  "numberOfElements": 1,
  "empty": false
}

The response also includes times of components that executed the WF, data like the recorded number, and much more.