Deprecated Glue API Calls Will Be Removed
Boston TechJam 2015, VR and EMBER 3D Printer

Retrieving Checklists Items with Section

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. 


Section info3

A sample Checklists in UI. Using simple data to make it easy to find corresponding values in the response below. 


Section info1a

Section info1

 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. 

        public static string ChecklistsV1Id(string ticket, string project_id, string id)
            // (1) Build request
            var client = new RestClient();
            client.BaseUrl = new System.Uri(_baseUrl);

            // Set resource or end point
            var request = new RestRequest();
            request.Resource = "/fieldapi/checklists/v1/{id}";
            request.Method = Method.GET;

            // Add parameters
            request.AddParameter("ticket", ticket);
            request.AddParameter("project_id", project_id);

            request.AddUrlSegment("id", id);

            // (2) Execute request and get response
            IRestResponse response = client.Execute(request);

            // (3) Parse the response in a way you want.
            // ...

            return "OK";