Api session event logic measurement point add: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
Created page with "API Endpoint: api/session/event/logic/measurement_point_add/ Description: Add a PointMeasurement for an Overlay. {|class=wikitable !Name !Importance !Type !Description !Values |- |0 |REQUIRED |(OVERLAY Integer ID or multiple 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..."
 
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
API Endpoint: api/session/event/logic/measurement_point_add/
API Endpoint: api/session/event/logic/measurement_point_add/


Description: Add a [[#Api Model Point|Point]][[Measurement]] for an [[Overlay]].
Description: Add a [[Point]][[Measurement]] for an [[Overlay]].


{|class=wikitable
{|class=wikitable
!Name
!Index
!Importance
!Importance
!Type
!Type
Line 10: Line 10:
!Values
!Values
|-
|-
|0
| 0
|REQUIRED
| REQUIRED
|(OVERLAY Integer ID or multiple values in array [1, 2, 3])
| (OVERLAY Integer ID or multiple integer values in array [1, 2, 3])
|[[Overlay]] IDs
| [[Overlay]] IDs
|
|  
|-
|-
|1
| 1
|REQUIRED
| REQUIRED
|(Point with crs: EPSG:3857)
| (Point with crs: EPSG:3857)
|[[#Api Model Point|Point]]
| [[Point]]
|
|  
|-
|-
|2
| 2
|REQUIRED
| REQUIRED
|(String)
| (String)
|Name
| Name
|
|  
|-
|-
|3
| 3
|REQUIRED
| REQUIRED
|(true, false)
| (true, false)
|Save [[Measurement]]
| Save [[Measurement]]
|true  or  false
| true  or  false
|-
|-
|4
| 4
|REQUIRED
| REQUIRED
|(true, false)
| (true, false)
|Sum
| Sum
|true  or  false
| true  or  false
|}
|}
===Response Codes===
===Response Codes===
Line 45: Line 45:
!Description
!Description
|-
|-
|200
| 200
|Integer (Measurement ID)
| Integer (Measurement ID)
|-
|-
|300-600
| 300-600
|Codes Overview
| Codes Overview
|}
|}
===Example POST===
===Example POST===
Curl example POST:
Curl example POST
 
<syntaxhighlight lang="text" copy>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 '
<syntaxhighlight lang="text" copy>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, {
[ 1, {
  "type" : "Point",
  "type" : "Point",
  "coordinates" : [ 658786.0962929523, 6799334.324819751 ]
  "coordinates" : [ 658755.5430447549, 6799403.859785236 ]
}, "Name", true, true ]
}, "Name", true, true ]
'
'
</syntaxhighlight>
</syntaxhighlight>
Curl example multi item POST:
Curl example multi item POST
 
<syntaxhighlight lang="text" copy>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 '
<syntaxhighlight lang="text" copy>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 ], {
[ [ 1, 2, 3 ], {
  "type" : "Point",
  "type" : "Point",
  "coordinates" : [ 658795.9320611367, 6799433.327952874 ]
  "coordinates" : [ 658770.2837039427, 6799300.127621367 ]
}, "Name", true, true ]
}, "Name", true, true ]
'
'
</syntaxhighlight>
</syntaxhighlight>
JavaScript example POST:
JavaScript example POST
 
<syntaxhighlight lang="text" copy>var options = {
<syntaxhighlight lang="text" copy>var options = {
 method: "POST",
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ 1, { "type" : "Point", "coordinates" : [ 658786.0962929523, 6799334.324819751 ]}, "Name", true, true ]'
 body: '[ 1, { "type" : "Point", "coordinates" : [ 658755.5430447549, 6799403.859785236 ]}, "Name", true, true ]'
};
};
fetch("https://engine.tygron.com/api/session/event/logic/measurement_point_add/?crs=3857", options)
fetch("https://engine.tygron.com/api/session/event/logic/measurement_point_add/?crs=3857", options)

Latest revision as of 13:03, 19 June 2026

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" : [ 658755.5430447549, 6799403.859785236 ]
}, "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" : [ 658770.2837039427, 6799300.127621367 ]
}, "Name", true, true ]
'

JavaScript example POST

var options = {
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ 1, { "type" : "Point", "coordinates" : [ 658755.5430447549, 6799403.859785236 ]}, "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));