Api session event editor netload import

From Tygron Support wiki
Jump to navigation Jump to search

API Endpoint: editornetload/import.

Description: Import multiple Net Loads

Name Importance Type Description Values
0 REQUIRED (GeometryCollection with crs: EPSG:3857) GeometryCollection
1 REQUIRED (String or multiple values in array ["a", "b", "c"]) String[]
2 REQUIRED (NetType or multiple values in array [a, b, c]) NetType[]
3 REQUIRED (TimeState or multiple values in array [a, b, c]) TimeState[]
4 REQUIRED (String or multiple values in array ["a", "b", "c"]) String[]
5 REQUIRED (String or multiple values in array ["a", "b", "c"]) String[]
6 REQUIRED (Floating point number or multiple values in array [1.0, 2.0, 3.0] or matrix [[1.0, 2.0], [3.0, 4.0], [5.0, 6.0]]) double[][]
7 REQUIRED (Integer number) Integer
8 REQUIRED (Floating point number) Double
9 REQUIRED (Floating point number) Double
10 REQUIRED (SOURCE Integer ID) Source

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/editornetload/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 ] ] ] ]
 } ]
}, "Text 1", "ELECTRICITY", "NOTHING", "Text 1", "Text 1", [ 1.0, 2.0 ], 1, 70, 33, 1 ]
'

Curl example multi item POST:

curl 'https://engine.tygron.com/api/session/event/editornetload/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 ] ] ] ]
 } ]
}, [ "Text 1", "Text 2", "Text 3" ], [ "ELECTRICITY", "GAS", "HEAT" ], [ "NOTHING", "WAITING_FOR_DATE", "REQUEST_PLOT_OWNER_APPROVAL" ], [ "Text 1", "Text 2", "Text 3" ], [ "Text 1", "Text 2", "Text 3" ], [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ], 1, 44, 85, 1 ]
'

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 ] ] ] ] } ]}, "Text 1", "ELECTRICITY", "NOTHING", "Text 1", "Text 1", [ 1.0, 2.0 ], 1, 70, 33, 1 ]'
};
fetch("https://engine.tygron.com/api/session/event/editornetload/import/?crs=3857", options)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));