Here is another question I got today.
Q. I’m using Field Checklists API to retrieve Checklists. But I cannot seem to distinguish items under different sections.
A. First, please make sure you use APIs under /fieldapi/. /api/get_checklists is deprecated.
You can use the following two REST calls to retrieve checklists and their detailed data:
- GET /fieldapi/checklists/v1 --- this allows to retrieve a list of checklists for a given project.
- GET /fieldapi/checklists/v1/:id --- this allows to retrieve the detailed information of a given checklist, including a list of items and sections. Here, ":id" is a id of a checklist. ":id" is specified as URL segment as oppose to a “name=parameter” pair.
Images below show a simple sample data in UI, and corresponding response from /fieldapi/checklists/v1/:id. I'm using the minimum data to make it easier to read data. In the JSON response, you see “sections” attributes. Checklist items are stored under a parent section.
A sample Checklists in UI. Using simple data to make it easy to find corresponding values in the response below.
A sample response from /fieldapi/checklists/v1/:id call. Compare the values with the UI above.
Below is a sample code snippet of /fieldapi/checklists/v1/:id using RestSharp library. Notice that we are using AddUrlSegment() with this call.