Api session event editor measurement import: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
Created page with "API Event to Import multiple [[Measurement]]s {|class=wikitable !Name !Importance !Type !Description !Values |- |0 |REQUIRED |(GeometryCollection with crs: EPSG:3857) |[[Measurement]]s | |- |1 |REQUIRED |(String or multiple values in array ["a", "b", "c"]) |[[Measurement]] Names | |- |2 |REQUIRED |(OVERLAY Integer ID or multiple values in array [1, 2, 3]) |Overlays | |- |3 |OPTIONAL |(SOURCE Integer ID) |Source (optional) | |} ===Response Codes=== {|c..."
 
No edit summary
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
API Event to Import multiple [[[[Measure]]ment]]s
API Endpoint: api/session/event/editormeasurement/import/
 
Description: Import multiple [[Measurement]]s
 
{|class=wikitable
{|class=wikitable
!Name
!Index
!Importance
!Importance
!Type
!Type
Line 7: Line 10:
!Values
!Values
|-
|-
|0
| 0
|REQUIRED
| REQUIRED
|(GeometryCollection with crs: EPSG:3857)
| (GeometryCollection with crs: EPSG:3857)
|[[[[Measure]]ment]]s
| [[Measurement]]s
|
|  
|-
|-
|1
| 1
|REQUIRED
| REQUIRED
|(String or multiple values in array ["a", "b", "c"])
| (String or multiple values in array ["a", "b", "c"])
|[[[[Measure]]ment]] Names
| [[Measurement]] Names
|
|  
|-
|-
|2
| 2
|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]]s
| [[Overlay]]s
|
|  
|-
|-
|3
| 3
|OPTIONAL
| OPTIONAL
|(SOURCE Integer ID)
| (SOURCE Integer ID)
|[[Source]] (optional)
| [[Source]] (optional)
|
|  
|}
|}
===Response Codes===
===Response Codes===
Line 36: Line 39:
!Description
!Description
|-
|-
|204
| 204
|No Content
| No Content
|-
|-
|300-600
| 300-600
|Codes Overview
| Codes Overview
|}
|}
===Example POST===
===Example POST===
Example POST: https://engine.tygron.com/api/session/event/editormeasurement/import/?crs=3857&f=HTML&token=API_TOKEN
Curl example POST
 
<syntaxhighlight lang="text" copy>curl 'https://engine.tygron.com/api/session/event/editormeasurement/import/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
with content:  
[ {
<pre>[ {
"type" : "GeometryCollection",
"geometries" : [ {
"type" : "MultiPolygon",
"coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
} ]
}, "Measurement Name 1", 1 ]
'
</syntaxhighlight>
Curl example multi item POST
<syntaxhighlight lang="text" copy>curl 'https://engine.tygron.com/api/session/event/editormeasurement/import/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ {
  "type" : "GeometryCollection",
  "type" : "GeometryCollection",
  "geometries" : [ {
  "geometries" : [ {
  "type" : "MultiPolygon",
  "type" : "MultiPolygon",
  "coordinates" : [ [ [ [ 658636.7618515313, 6799461.8964563515 ], [ 658636.7618515313, 6799320.123610025 ], [ 658729.9385392354, 6799320.123610025 ], [ 658729.9385392354, 6799461.8964563515 ], [ 658636.7618515313, 6799461.8964563515 ] ] ] ]
  "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
  }, {
  }, {
  "type" : "MultiPolygon",
  "type" : "MultiPolygon",
  "coordinates" : [ [ [ [ 658636.7618515313, 6799461.8964563515 ], [ 658636.7618515313, 6799410.034708745 ], [ 658768.0618857662, 6799410.034708745 ], [ 658768.0618857662, 6799461.8964563515 ], [ 658636.7618515313, 6799461.8964563515 ] ] ] ]
  "coordinates" : [ [ [ [ 658646.762, 6799451.896 ], [ 658646.762, 6799461.896 ], [ 658656.762, 6799461.896 ], [ 658656.762, 6799451.896 ], [ 658646.762, 6799451.896 ] ] ] ]
  }, {
  }, {
  "type" : "MultiPolygon",
  "type" : "MultiPolygon",
  "coordinates" : [ [ [ [ 658636.7618515313, 6799461.8964563515 ], [ 658636.7618515313, 6799351.946437823 ], [ 658736.9856657466, 6799351.946437823 ], [ 658736.9856657466, 6799461.8964563515 ], [ 658636.7618515313, 6799461.8964563515 ] ] ] ]
  "coordinates" : [ [ [ [ 658656.762, 6799451.896 ], [ 658656.762, 6799461.896 ], [ 658666.762, 6799461.896 ], [ 658666.762, 6799451.896 ], [ 658656.762, 6799451.896 ] ] ] ]
  } ]
  } ]
}, [ "Measurement Name 1", "Measurement Name 2", "Measurement Name 3" ], [ 1, 2, 3 ], "" ]
}, [ "Measurement Name 1", "Measurement Name 2", "Measurement Name 3" ], [ 1, 2, 3 ] ]
</pre>
'
{{article end|seealso=*[[api session event editor measurement]]}}
</syntaxhighlight>
JavaScript example POST
<syntaxhighlight lang="text" copy>var options = {
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ { "type" : "GeometryCollection", "geometries" : [ { "type" : "MultiPolygon", "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ] } ]}, "Measurement Name 1", 1 ]'
};
fetch("https://engine.tygron.com/api/session/event/editormeasurement/import/?crs=3857", options)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));
</syntaxhighlight>
{{article end|seealso=*[[Api session event editor measurement]]
*[[Api session items measurements]]
}}


[[Category:API]]
[[Category:API]]

Latest revision as of 12:22, 17 June 2026

API Endpoint: api/session/event/editormeasurement/import/

Description: Import multiple Measurements

Index Importance Type Description Values
0 REQUIRED (GeometryCollection with crs: EPSG:3857) Measurements
1 REQUIRED (String or multiple values in array ["a", "b", "c"]) Measurement Names
2 REQUIRED (OVERLAY Integer ID or multiple integer values in array [1, 2, 3]) Overlays
3 OPTIONAL (SOURCE Integer ID) Source (optional)

Response Codes

Response Code: Description
204 No Content
300-600 Codes Overview

Example POST

Curl example POST

curl 'https://engine.tygron.com/api/session/event/editormeasurement/import/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ {
 "type" : "GeometryCollection",
 "geometries" : [ {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
 } ]
}, "Measurement Name 1", 1 ]
'

Curl example multi item POST

curl 'https://engine.tygron.com/api/session/event/editormeasurement/import/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ {
 "type" : "GeometryCollection",
 "geometries" : [ {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
 }, {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658646.762, 6799451.896 ], [ 658646.762, 6799461.896 ], [ 658656.762, 6799461.896 ], [ 658656.762, 6799451.896 ], [ 658646.762, 6799451.896 ] ] ] ]
 }, {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658656.762, 6799451.896 ], [ 658656.762, 6799461.896 ], [ 658666.762, 6799461.896 ], [ 658666.762, 6799451.896 ], [ 658656.762, 6799451.896 ] ] ] ]
 } ]
}, [ "Measurement Name 1", "Measurement Name 2", "Measurement Name 3" ], [ 1, 2, 3 ] ]
'

JavaScript example POST

var options = {
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ { "type" : "GeometryCollection", "geometries" : [ { "type" : "MultiPolygon", "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ] } ]}, "Measurement Name 1", 1 ]'
};
fetch("https://engine.tygron.com/api/session/event/editormeasurement/import/?crs=3857", options)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));