Api session event logic measurement point add

From Tygron Support wiki
Jump to navigation Jump to search

API Endpoint: api/session/event/logic/measurement_point_add/

Description: Add a PointMeasurement for an Overlay.

Index Importance Type Description Values
0 REQUIRED (OVERLAY Integer ID or multiple integer values in array [1, 2, 3]) Overlay IDs
1 REQUIRED (Point with crs: EPSG:3857) Point
2 REQUIRED (String) Name
3 REQUIRED (true, false) Save Measurement true or false
4 REQUIRED (true, false) Sum true or false

Response Codes

Response Code: Description
200 Integer (Measurement ID)
300-600 Codes Overview

Example POST

Curl example POST

curl 'https://engine.tygron.com/api/session/event/logic/measurement_point_add/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ 1, {
 "type" : "Point",
 "coordinates" : [ 658753.1100888863, 6799367.585046952 ]
}, "Name", true, true ]
'

Curl example multi item POST

curl 'https://engine.tygron.com/api/session/event/logic/measurement_point_add/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ [ 1, 2, 3 ], {
 "type" : "Point",
 "coordinates" : [ 658680.9464739645, 6799430.791061646 ]
}, "Name", true, true ]
'

JavaScript example POST

var options = {
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ 1, { "type" : "Point", "coordinates" : [ 658753.1100888863, 6799367.585046952 ]}, "Name", true, true ]'
};
fetch("https://engine.tygron.com/api/session/event/logic/measurement_point_add/?crs=3857", options)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));