Api session event editor netload import: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
Created page with "API Event to Import multiple Netloads {|class=wikitable !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 a..."
 
No edit summary
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
API Event to Import multiple Netloads
API Endpoint: api/session/event/editornetload/import/
 
Description: Import a Collection of [[Net Load]] geometries, names, [[Net Type]]s, [[Net state]], to an existing Net by adding [[Net Line]]s with the provided [[Net Function]]. A [[Building]] is assigned to a [[Net Load]] when within [[Building]] range. A [[Net Load]] is assigned to a [[Net Node]] when within [[Net Node]] range
 
{|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)
|GeometryCollection
| [[Net Load]] Geometries
|
|  
|-
|-
|1
| 1
|REQUIRED
| REQUIRED
|(String or multiple values in array ["a", "b", "c"])
| (String or multiple values in array ["a", "b", "c"])
|String[]
| Names
|
|  
|-
|-
|2
| 2
|REQUIRED
| REQUIRED
|(NetType or multiple values in array [a, b, c])
| (NetType or multiple values in array [a, b, c])
|NetType[]
| [[Net Type]]s
|
|  
|-
|-
|3
| 3
|REQUIRED
| REQUIRED
|(TimeState or multiple values in array [a, b, c])
| (TimeState or multiple values in array [a, b, c])
|[[Time]]State[]
| [[Net state]]
|
|  
|-
|-
|4
| 4
|REQUIRED
| REQUIRED
|(String or multiple values in array ["a", "b", "c"])
| (String or multiple values in array ["a", "b", "c"])
|String[]
| Concateneted [[Address]]es
|
|  
|-
|-
|5
| 5
|REQUIRED
| REQUIRED
|(String or multiple values in array ["a", "b", "c"])
| (String or multiple values in array ["a", "b", "c"])
|String[]
| [[Attribute]]s
|
|  
|-
|-
|6
| 6
|REQUIRED
| 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]])
| (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[][]
| [[Attribute]] Values array
|
|  
|-
|-
|7
| 7
|REQUIRED
| REQUIRED
|(Integer number)
| (Integer number)
|Integer
| Index of Root Load Geometry
|
|  
|-
|-
|8
| 8
|REQUIRED
| REQUIRED
|(Floating point number)
| (Floating point number)
|Double
| [[Building]] Range
|
|  
|-
|-
|9
| 9
|REQUIRED
| REQUIRED
|(Floating point number)
| (Floating point number)
|Double
| [[Net Node]] Range
|
|  
|-
|-
|10
| 10
|REQUIRED
| REQUIRED
|(SOURCE Integer ID)
| (SOURCE Integer ID)
|[[Source]]s
| [[Source]]
|
|  
|}
|}
===Response Codes===
===Response Codes===
Line 78: Line 81:
!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/editornetload/import/?crs=3857&f=HTML&token=API_TOKEN
Curl example POST
 
<syntaxhighlight lang="text" copy>curl 'https://engine.tygron.com/api/session/event/editornetload/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 ] ] ] ]
} ]
}, "Name 1", "ELECTRICITY", "NOTHING", "Concateneted Addresse 1", "Attribute 1", [ 1.0, 2.0 ], 1, 51, 32, 1 ]
'
</syntaxhighlight>
Curl example multi item POST
<syntaxhighlight lang="text" copy>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",
  "type" : "GeometryCollection",
  "geometries" : [ {
  "geometries" : [ {
  "type" : "MultiPolygon",
  "type" : "MultiPolygon",
  "coordinates" : [ [ [ [ 658636.7618515313, 6799461.8964563515 ], [ 658636.7618515313, 6799405.5326335905 ], [ 658689.5852538476, 6799405.5326335905 ], [ 658689.5852538476, 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, 6799338.406210458 ], [ 658769.5901978306, 6799338.406210458 ], [ 658769.5901978306, 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, 6799423.640021066 ], [ 658641.4945841088, 6799423.640021066 ], [ 658641.4945841088, 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 ] ] ] ]
  } ]
  } ]
}, [ "Text 1", "Text 2", "Text 3" ], [ "ELECTRICITY", "HEAT", "SEWER" ], [ "REQUEST_CONSTRUCTION_APPROVAL", "REQUEST_PLOT_OWNER_APPROVAL", "PENDING_UPGRADE" ], [ "Text 1", "Text 2", "Text 3" ], [ "Text 1", "Text 2", "Text 3" ], [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ], 88, 39, 62, 57 ]
}, [ "Name 1", "Name 2", "Name 3" ], [ "ELECTRICITY", "GAS", "HEAT" ], [ "NOTHING", "WAITING_FOR_DATE", "REQUEST_PLOT_OWNER_APPROVAL" ], [ "Concateneted Addresse 1", "Concateneted Addresse 2", "Concateneted Addresse 3" ], [ "Attribute 1", "Attribute 2", "Attribute 3" ], [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ], 1, 32, 36, 1 ]
</pre>
'
{{article end|seealso=*[[api session event editor netload]]}}
</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 ] ] ] ] } ]}, "Name 1", "ELECTRICITY", "NOTHING", "Concateneted Addresse 1", "Attribute 1", [ 1.0, 2.0 ], 1, 51, 32, 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));
</syntaxhighlight>
{{article end|seealso=*[[Api session event editor netload]]
*[[Api session items netloads]]
}}


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

Latest revision as of 14:52, 11 November 2026

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

Description: Import a Collection of Net Load geometries, names, Net Types, Net state, to an existing Net by adding Net Lines with the provided Net Function. A Building is assigned to a Net Load when within Building range. A Net Load is assigned to a Net Node when within Net Node range

Index Importance Type Description Values
0 REQUIRED (GeometryCollection with crs: EPSG:3857) Net Load Geometries
1 REQUIRED (String or multiple values in array ["a", "b", "c"]) Names
2 REQUIRED (NetType or multiple values in array [a, b, c]) Net Types
3 REQUIRED (TimeState or multiple values in array [a, b, c]) Net state
4 REQUIRED (String or multiple values in array ["a", "b", "c"]) Concateneted Addresses
5 REQUIRED (String or multiple values in array ["a", "b", "c"]) Attributes
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]]) Attribute Values array
7 REQUIRED (Integer number) Index of Root Load Geometry
8 REQUIRED (Floating point number) Building Range
9 REQUIRED (Floating point number) Net Node Range
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 ] ] ] ]
 } ]
}, "Name 1", "ELECTRICITY", "NOTHING", "Concateneted Addresse 1", "Attribute 1", [ 1.0, 2.0 ], 1, 51, 32, 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 ] ] ] ]
 } ]
}, [ "Name 1", "Name 2", "Name 3" ], [ "ELECTRICITY", "GAS", "HEAT" ], [ "NOTHING", "WAITING_FOR_DATE", "REQUEST_PLOT_OWNER_APPROVAL" ], [ "Concateneted Addresse 1", "Concateneted Addresse 2", "Concateneted Addresse 3" ], [ "Attribute 1", "Attribute 2", "Attribute 3" ], [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ], 1, 32, 36, 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 ] ] ] ] } ]}, "Name 1", "ELECTRICITY", "NOTHING", "Concateneted Addresse 1", "Attribute 1", [ 1.0, 2.0 ], 1, 51, 32, 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));