Workbooks
In order to query all available workbooks in iCL Portal, the following REST service can be used.
Endpoint: /api/services/app/workbook
1. Querying workbooks
Url: /GetWorkbooks
HTTP method: GET
Required permission: Workbooks.List
It returns the latest version of each workbook that has not been deleted.
At most 500 workbooks are returned per request. If there are more, result.__next contains the URL of the next page.
Optional parameter: workbookId - the id of a specific workbook version that is included in the result as well, even if it is not the latest version or has been deleted.
Example:
GET https://dev.iclportal.com/api/services/app/workbook/GetWorkbooks HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept-Encoding: gzip, deflate
{
"result": {
"results": [
{
"id": "d4548668-a2a2-4e30-b21d-5fc312d2d660",
"definitionId": "c589a1f4-1049-4018-a5ae-36c23a54221e",
"version": "1.0.0.5",
"versionCode": 5,
"title": "Task with Finding Test",
"name": "Task with Finding Test",
"description": null,
"isPublished": true,
"creationTime": "2017-02-14T17:30:37.873Z",
"isDeleted": false,
"deletionTime": null,
"deleterUser": null,
"retentionInDays": null,
"numberOfVersions": 5,
"numberOfTeams": 2,
"numberOfTestTeams": 0
}
],
"__count": 1
}
}
| Name | Type | Description |
|---|---|---|
| retentionInDays | number | The retention period of the workbook in days, i.e. the number of days after which completed inspections are deleted from the users' devices. null if the default retention period applies. |
| numberOfVersions | number | The number of versions of the workbook. |
| numberOfTeams | number | The number of teams the workbook is assigned to. |
| numberOfTestTeams | number | The number of teams in which the workbook is in test mode. |
Example 2 – getting only workbooks, which have already been published (and, thus, are available to inspectors in the field), and also 20 results at max
GET https://dev.iclportal.com/api/services/app/workbook/GetWorkbooks?$filter=IsPublished+eq+true&$inlinecount=allpages&$orderby=CreationTime+desc&$top=20 HTTP/1.1
Content-Type: application/json;charset=UTF-8
Accept-Encoding: gzip, deflate
{
"result": {
"results": [
{
"id": "d4548668-a2a2-4e30-b21d-5fc312d2d660",
"definitionId": "c589a1f4-1049-4018-a5ae-36c23a54221e",
"version": "1.0.0.5",
"versionCode": 5,
"title": "Sample Workbook",
"name": "Sample Workbook",
"description": null,
"isPublished": true,
"creationTime": "2017-02-14T17:30:37.873Z",
"isDeleted": false,
"deletionTime": null,
"deleterUser": null,
"retentionInDays": null,
"numberOfVersions": 5,
"numberOfTeams": 2,
"numberOfTestTeams": 0
}
],
"__count": 1
}
}
Parameters: This is an ODATA 3.0 Endpoint allowing you to query the workbooks in the system.
you can use all the attributes of the returned json objects to create a query. However, due to the ODATA specification, you must uppercase them in the query. As this is a convention in JSON and the JavaScript world, our results are returned with the attribute names lowercased.
Example: You get a workbook like:
{"isPublished":true, "title":"Sample Workbook", …}
As you can see, the “isPublished” attribute is starting with a lowercased letter.
If you, however, query the ODATA endpoint using “isPublished”, you need to uppercase its first letter:
/GetWorkbooks?$filter=IsPublished+eq+….