APIを使用してタスクの詳細を要求します。
タスクの詳細をAPIで取得する方法
検査タスクのデータの後処理など、さまざまなユースケースに対応します。Frontline コマンドセンターからこのデータを要求する必要がある場合があります。このページでは、その方法を説明します。
まず、どのようなタスクが実行されたかを調べ、後でその中の1つについて詳細を知ることができます。これは次のように行います。
- API経由でFrontline Command Center にログインします。
- LoginレスポンスからTokenを抽出し、次のレスポンスでBearer Tokenとして使用します。
- https://my-address/wftasks/getTasksForDisplayへの GET リクエストを作成します。
このように出力されます。
{
"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
}
これは最初の20個のタスクのリストです。このリストはhttps://my-address/xinspect.html#!/tasksでも見ることができます。リクエストのURLで指定することで、リストをプリソートすることもできます。例えば、次のようなものです。
https://my-address/wftasks/getTasksForDisplay?page=0&size=20&sort=createDate,desc
これで、最後に作成された20個のタスクが応答するようになりました。
特定のタスクに関する詳細情報を取得するには、タスクのIDを追加してリクエストを修正する必要があります。
https://192.168.2.116/wftasks/getTasksForDisplay?page=0&size=1&taskId=67&templates=false
応答は次のようになる。
{
"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
}
また、構成要素の時間、誰がWFを実行したか、記録された番号などのデータも含まれるなど、さまざまな情報を得ることができます。