Measurement Data

A measurement consists of properties directly associated with the measurement and a number of different measurement topic models.

Each measurement and measurement topic has a corresponding template in Congrid. Hence the API user should know the following `templateId´ values:

  • One value for the the measurement
  • One value for each of the measurement topics

The templateId values are available through the Congrid UI - change the {projectId} to the project to see the available templates of the project:

https://congrid.fi/live/{projectId}/templates/

All the templates can also be fetched through the following API end-points:

/measurementTemplates
/measurementTopicTemplates

Please refer to the measurement templates section for more details.

Import a measurement to Congrid

To import a measurement to Congrid system perform a POST to the following end-point.

/measurements

Remember that you will need to have the correct projectId and templateId values in order to map the measurement with the correct project and templates.

Example requests:

curl
JavaScript
curl -X POST -H "Content-Type: application/json" -H "Congrid-API-Token: YOUR-API-TOKEN" -d '{
    "measurementTypeId": "TR",
    "name" : "Test TR - measurement import",
    "projectId": "PilvPWN3hZoNq4UOXVg6FFklXBJRTVzQ",
    "templateId": "7",
    "topics": [
        {
          "templateId": "31",
          "plusCount": 9,
          "minusCount": 5
        },
        {
          "templateId": "32",
          "plusCount": 7,
          "minusCount": 11
        },
        {
          "templateId": "33",
          "plusCount": 6,            
          "minusCount": 1
        },
        {
          "templateId": "34",
          "plusCount": 1,
          "minusCount": 6
        },
        {
          "templateId": "35",
          "plusCount": 15,
          "minusCount": 5
        },
        {
          "templateId": "36",
          "plusCount": 5,
          "minusCount": 10
        },
        {
          "templateId": "37",
          "plusCount": 6,
          "minusCount": 11
        }                
    ]
}
' "https://api.congrid.com/v1/measurements"
var request = require("request");

var options = { method: 'POST',
  url: 'https://api.congrid.com/v1/measurements',
  headers: 
   { 'congrid-api-token': 'YOUR-API-TOKEN',
     'content-type': 'application/json' },
  body: 
   { measurementTypeId: 'TR',
     name: 'Test TR - measurement import',
     projectId: 'PilvPWN3hZoNq4UOXVg6FFklXBJRTVzQ',
     templateId: '7',
     topics: 
      [ { templateId: '31', plusCount: 9, minusCount: 5 },
        { templateId: '32', plusCount: 7, minusCount: 11 },
        { templateId: '33', plusCount: 6, minusCount: 1 },
        { templateId: '34', plusCount: 1, minusCount: 6 },
        { templateId: '35', plusCount: 15, minusCount: 5 },
        { templateId: '36', plusCount: 5, minusCount: 10 },
        { templateId: '37', plusCount: 6, minusCount: 11 } ] },
  json: true };

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

  console.log(body);
});

Example response:

{
  "createdAt": "2017-04-06T12:24:53.017711Z",
  "measurementCategoryId": "INTERNAL",
  "measurementId": "14",
  "measurementTypeId": "TR",
  "modifiedAt": "2017-04-06T12:24:53.021473Z",
  "name": "Test TR - measurement import",
  "projectCode": "A-123456",
  "projectId": "PilvPWN3hZoNq4UOXVg6FFklXBJRTVzQ",
  "projectName": "Tutorial project",
  "statusId": "PENDING",
  "templateId": "7",
  "result": 0.50,
  "weekNumber": 14,
  "year": 2017
}        

results matching ""

    No results matching ""