Skip to main content

Inspections

In order to retrieve the raw data and images from an inspection, you can use the inspection services.

Endpoint: /api/services/custom/inspection

1. Getting inspection raw data

Url: /{identifier}/data

HTTP method: GET

The identifier can be either the task id, inspection id, or the tasks external id (called “reference” in the user interface)

Example:

Request:

GET https://dev.iclportal.com/ api/services/custom/inspection/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/data HTTP/1.1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept-Encoding: gzip, deflate

Response:

{
"result": [
{
"externalId": null,
"created": "2017-12-20T15:54:42Z",
"closed": "2017-12-21T08:47:45Z",
"checklist": "SV",
"checklistId": "c965a4d8-9be8-4f4f-aaf3-409bab9a3c48",
"chapter": "Messung Anspeisung",
"headline": "Zeitpunkt",
"questionName": "Netzart_mes",
"questionTitle": "Netzart",
"questionType": "TextBoxIdentifier",
"value": "SV",
"isSelected": false,
"valueRaw": null,
"likelihoodToFail": null,
"priorityFactor": null,
"rating": null,
"scopePath": ""
},
...
],
"targetUrl": null,
"success": true,
"error": null,
"unAuthorizedRequest": false,
"__abp": true
}

The data in the result array is a flattened-out representation of all the answers that the inspector entered during an inspection. The entries are ordered by checklistid and then by scopePath.

The scopePath is a very important concept if you are working with repeated sections (headlines or chapters). Whenever an answer value belongs to some repeated section (e.g. information about a defect within a repeated headline), it will have a scopePath which denotes that. In the following example, a repeated headline “Defect” has two questions “location” and “defect_picture”:

[
{
"externalId": null,
"created": "2017-12-20T15:54:42Z",
"closed": "2017-12-21T08:47:45Z",
"checklist": "SV",
"checklistId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"chapter": "Staircase",
"headline": "Defect",
"questionName": "location",
"questionTitle": "Where is the defect located?",
"questionType": "TextBoxIdentifier",
"value": "1st floor",
"isSelected": false,
"valueRaw": null,
"likelihoodToFail": null,
"priorityFactor": null,
"rating": null,
"scopePath": "/Defect:0"
},{
"externalId": null,
"created": "2017-12-20T15:54:42Z",
"closed": "2017-12-21T08:47:45Z",
"checklist": "SV",
"checklistId": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"chapter": "Staircase",
"headline": "Defect",
"questionName": "defect_picture",
"questionTitle": "Picture:",
"questionType": "TakePictureIdentifier",
"value": "47c89e2d-4665-4fe0-947a-f99feff40a96.jpeg",
"isSelected": false,
"valueRaw": “b2a5161e-cd5c-4c0a-9ce6-2af34b8082df”,
"likelihoodToFail": null,
"priorityFactor": null,
"rating": null,
"scopePath": "/Defect:0"
},
]

As you can see, all answers belonging to one specific repeated headline (or chapter) will always have the same scopepath.

note

If there was another repeated defect headline its scopepath would be “/Defect:1” as the scopePath is always constructed using the headlines name and its index within the scope

The values you get for each row should be quite self-explanatory. The only field which deserves further explanation, however, is “valueRaw”.

valueRaw: is a helper field for finding questions. When your checklist contains a question of type “MakeObservationIdentifier” where the user has to select some item from a hierarchy of items, then the value of that answer will be the human-readable version of that selected item and its path. E.g.: Defect/Staircase/HandrailMissing This particular item (HandrailMissing) can also be found using its unique identifier (XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX) and it is this identifier, which is included in valueRaw.

2. Getting the list of pictures

Url: /{identifier}/pictures

HTTP method: GET

The identifier can be either the task id, inspection id, or the tasks external id (called “reference” in the user interface)

Example:

Request:

GET https://dev.iclportal.com/ api/services/custom/inspection/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/pictures HTTP/1.1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept-Encoding: gzip, deflate

Response:

{
"result": [
{
"id": "b2a5161e-cd5c-4c0a-9ce6-2af34b8082df",
"title": "47c89e2d-4665-4fe0-947a-f99feff40a96.jpeg",
"description": null,
"showInReport": false,
"scope": "Checklist"
},
{
"id": "bc73aeed-a283-482e-bf5e-4cfa26ce7513",
"title": "737ae90e-d683-4909-b3de-961ccbed7b16.jpeg",
"description": null,
"showInReport": false,
"scope": "Inspection"
}
],
"targetUrl": null,
"success": true,
"error": null,
"unAuthorizedRequest": false,
"__abp": true
}

The data in the result array is a list of all the pictures taken during an inspection. Particularly interesting is the field scope which denotes, whether the picture was taken within a checklist, or in the inspections general picture tab.

note

that when you are getting the answer of a “TakePicture” question of the inspection/{inspectionIdentifier}/data endpoint, you will actually get the title of that picture as the answer value.

Also, you will get the id of the picture as valueRaw. In the example of 5.1, one answer actually contained the picture b2a5161e-cd5c-4c0a-9ce6-2af34b8082df.

Both, the pictures id and its title, can be used to download the picture from the download image endpoint

3. Downloading a picture

Url: /{identifier}/pictures/{pictureIdentifier}/raw

HTTP method: GET

The identifier can be either the task id, inspection id, or the tasks external id (called “reference” in the user interface) The pictureIdentifier can be either the pictures title or its id. You can bet both these informations from the endpoints 5.1 and 5.2

Example:

Request:

GET https://dev.iclportal.com/ api/services/custom/inspection/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/pictures/b2a5161e-cd5c-4c0a-9ce6-2af34b8082df/raw HTTP/1.1 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept-Encoding: gzip, deflate

Response:

HTTP/1.1 200 OK
Cache-Control: no-store, must-revalidate, no-cache, max-age=0
Content-Type: image/jpeg
Content-Encoding: gzip
Server: Microsoft-IIS/10.0
Set-Cookie: fileDownload=true; path=/
Content-Disposition: attachment; filename=47c89e2d-4665-4fe0-947a-f99feff40a96.jpeg
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 02 May 2018 08:56:52 GMT
Content-Length: 45776

… raw data …