Notes

Notes are the building blocks of many parts in the Congrid system. Notes can be recorded as individual entities, such as safety or photo notes. They can also be associated with lists, measurements and inspections .

Congrid API exposes end-points to fetch notes generated by end-users.

Fetching notes

Fetching notes is easy through the root level notes end-point

/notes

NOTE

By default this will return all the notes for all the projects you have access to. To fetch notes of a specific project you can use the optional projectId query parameter.


Below is an example request and a response for fetching all the notes of all projects.

Request:

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

var options = { method: 'GET',
  url: 'https://api.congrid.com/v1/notes',
  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);
});

Response:

{
  "count" : 3,
  "pageSize" : 100,
  "results" : [ {
    "createdAt" : "2017-02-12T20:06:00.073Z",
    "id" : "407513",
    "noteTypeId" : "PHOTO",
    "projectId" : "PilvPWN3hZoNq4UOXVg6FFklXBJRTVzQ",
    "statusId" : "PENDING",
    "targetId" : "IDgIazNytovhC2wK0InHSsKT"
  }, {
    "id" : "407512",
    "inspectionId" : "21433",
    "inspectionTopicId" : "115415",
    "noteTypeId" : "QUALITY",
    "projectId" : "PilvPWN3hZoNq4UOXVg6FFklXBJRTVzQ",
    "statusId" : "PENDING",
    "targetId" : "IDgIazNytovhC2wK0InHSsKT"
  }, {
    "createdAt" : "2017-02-11T16:32:36.572Z",
    "id" : "407511",
    "measurementId" : "21516",
    "measurementTopicId" : "115506",
    "noteTypeId" : "TR",
    "projectId" : "PilvPWN3hZoNq4UOXVg6FFklXBJRTVzQ",
    "statusId" : "PENDING"
  } ]
}

Limiting results by query parameters

You can use query parameters to limit the results. The following are the most commonly used query parameters:

  • noteTypeId - limit by note type
  • measurementId - limit by a measurement
  • measurementTopicId - limit by a measurement topic
  • inspectionId - limit by an inspection
  • inspectionTopicId - limit by an inspection topic
  • listId - limit by a list

With a couple of examples

# Fetch all notes with measurementId 12 
/notes?measurementId=12

# Fetch all notes with measurementId 12 AND measurementTopicId 5
# This is a sub set of the previous query
/notes?measurementId=12&measurementTopicId=5

# Fetch all notes with inspectionId 10
/notes?inspectionId=10

# Fetch all notes with inspectionId 12 AND inspectionTopicId 5
# This is a sub set of the previous query
/notes?inspectionId=10&inspectionTopicId=15

# Fetch all Photo notes    
/notes?noteTypeId=PHOTO

Fetching notes modified during a time period

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

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

For the first day:

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

For the second day:

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

When a note is created it's modifiedAt value is set to the value when it was created. Hence these requests would return both, the newly created and modified notes from the time periods specified by the query parameters.

results matching ""

    No results matching ""