Inspection Data

Inspections are related to the processes of the construction site and the using company. Therefore by nature inspections are something that are usually customized by different companies or projects to meet the varying requirements.

Congrid exposes an API to fetch the created inspections through the API.

Fetching inspections

To fetch all the inspections perform a GET to the following end-point.

/inspections

This end-point supports two commonly used query parameters:

  • projectId - to fetch inspections of a specific project
  • statusId - to fetch inspections that have one of the queried statuses

Example requests:

curl
JavaScript
curl -X GET -H "Content-Type: application/json" -H "Congrid-API-Token: YOUR-API-TOKEN" \
  "https://api.congrid.com/v1/inspections"
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.congrid.com/v1/inspections',
  headers: 
   { 'congrid-api-token': 'YOUR-API-TOKEN',
     'content-type': 'application/json' } };
     
request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Example response:

{
  "count": 2,
  "pageSize": 100,
  "results": [
    {
      "createdAt": "2016-11-08T11:59:11.168Z",
      "id": "13773",
      "modifiedAt": "2016-12-15T06:13:26.089011Z",
      "name": "Quality inspections 133",
      "projectId": "PilvPWN3hZoNq4UOXVg6FFklXBJRTVzQ",
      "statusId": "COMPLETED",
      "targetId": "iwq161fx14nmainvweuyqn07vk15vc46",
      "templateId": "489"
    },
    {
      "createdAt": "2016-11-14T12:57:16.712Z",
      "id": "13777",
      "modifiedAt": "2016-11-14T12:58:29.67265Z",
      "name": "Quality inspection 117, Inspection Diary",
      "projectId": "PilvPWN3hZoNq4UOXVg6FFklXBJRTVzQ",
      "statusId": "PENDING",
      "targetId": "ZmFtxYzZpAnu9xRwRnNLcDRo"
    }    
  ]
}

Fetching inspections from a time period

To fetch inspections from a certain time range use the modifiedAtGt, modifiedAtGte, modifiedAtLt, modifiedAtLte query parameters.

A common approach is to automate the fetching of inspections for example on a daily basis. One could use the following queries to fetch the inspections from two subsequent days:

For the first day:

/inspections?modifiedAtGte=2017-01-01T00:00:00&?modifiedAtLt=2017-01-02T00:00:00

For the second day:

/inspections?modifiedAtGte=2017-01-02T00:00:00&?modifiedAtLt=2017-01-03T00:00:00

Inspection topics

To fetch the inspection topics of a particular inspection one can use the root level end-point for fetching the topics and limit the response through the inspectionId query parameter.

/inspectionTopics?inspectionId={inspectionId}

Below is an example to fetch the inspection topics of one of the inspections with inspection id 13777 from above:

Request:

curl
JavaScript
curl -X GET -H "Content-Type: application/json" -H "Congrid-API-Token: YOUR-API-TOKEN" \
  "https://api.congrid.com/v1/inspectionTopics?inspectionId=13777"
var request = require("request");

var options = { method: 'GET',
  url: 'https://api.congrid.com/v1/inspectionTopics',
  qs: { inspectionId: '13777' },
  headers: 
   { 'congrid-api-token': 'YOUR-API-TOKEN',
     'content-type': 'application/json' } };

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Example response:

{
  "count": 2,
  "pageSize": 100,
  "results": [
    {
      "id": "106535",
      "inspectionId": "13777",
      "name": "Inspection 1",
      "orderNumber": "1",
      "statusId": "PENDING",
      "templateId": "173650"
    },
    {
      "id": "106534",
      "inspectionId": "13777",
      "name": "Inspection 2",
      "orderNumber": "2",
      "statusId": "PENDING",
      "templateId": "173649"
    }      
  ]
}

results matching ""

    No results matching ""