Api session event editor netload generate loads: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(17 intermediate revisions by the same user not shown)
Line 1: Line 1:
API Event to Generate Loads
API Endpoint: api/session/event/editornetload/generate_loads/
 
Description: Generate [[Net Load]]s with a provided [[Net Type]], for [[Address]]es of [[Building]]s inside the provided [[Polygon]]s, for [[Building]]s of the provided [[Category]] and [[Stakeholder]]s and optionally only for [[Building]]s without [[Net Load]]s. [[Address]]es are bundled into one [[Net Load]] given a bundle threshold. [[Net Load]]s are set as Collective given another threshold. [[Stakeholder]] owning the [[Net Load]] can be mapped from the [[Building]] owner to a different one using the mappingIDs
 
{|class=wikitable
{|class=wikitable
!Name
!Index
!Importance
!Importance
!Type
!Type
Line 7: Line 10:
!Values
!Values
|-
|-
|0
| 0
|REQUIRED
| REQUIRED
|(Enumeration)
| (Enumeration)
|NetType
| [[Net Type]]
|ELECTRICITY, GAS, HEAT, INTERNET  or  SEWER
| ELECTRICITY, GAS, HEAT, INTERNET  or  SEWER
|-
|-
|1
| 1
|REQUIRED
| REQUIRED
|(MultiPolygon with crs: EPSG:3857)
| (MultiPolygon with crs: EPSG:3857)
|MultiPolygon
| Region
|
|  
|-
|-
|2
| 2
|REQUIRED
| REQUIRED
|(Category or multiple values in array [a, b, c])
| (Category or multiple values in array [a, b, c])
|[[Category]][]
| [[Building]] Categories
|
|  
|-
|-
|3
| 3
|REQUIRED
| REQUIRED
|(Integer number)
| (Integer number)
|Integer
| Bundle Threshold
|
|  
|-
|-
|4
| 4
|REQUIRED
| REQUIRED
|(Integer number)
| (Integer number)
|Integer
| Collective Threshold
|
|  
|-
|-
|5
| 5
|REQUIRED
| REQUIRED
|(STAKEHOLDER Integer ID or multiple values in array [1, 2, 3])
| (STAKEHOLDER Integer ID or multiple integer values in array [1, 2, 3])
|[[Stakeholder]]
| [[Stakeholder]]s ([[Building]] owners)
|
|  
|-
|-
|6
| 6
|REQUIRED
| REQUIRED
|(STAKEHOLDER Integer ID or multiple values in array [1, 2, 3])
| (STAKEHOLDER Integer ID or multiple integer values in array [1, 2, 3])
|[[Stakeholder]]
| [[Stakeholder]]s (mapped)
|
|  
|-
|-
|7
| 7
|REQUIRED
| REQUIRED
|(true, false)
| (true, false)
|Boolean
| Skip [[Building]]s with [[Net Load]]s
|true  or  false
| true  or  false
|}
|}
===Response Codes===
===Response Codes===
Line 60: Line 63:
!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/generate_loads/?crs=3857&f=JSON&token=API_TOKEN
Curl example POST
 
<syntaxhighlight lang="text" copy>curl 'https://engine.tygron.com/api/session/event/editornetload/generate_loads/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
with content:  
[ "ELECTRICITY", {
<pre>[ "HEAT", {
"type" : "MultiPolygon",
"coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
}, "SOCIAL", 1, 1, 1, 1, true ]
'
</syntaxhighlight>
Curl example multi item POST
<syntaxhighlight lang="text" copy>curl 'https://engine.tygron.com/api/session/event/editornetload/generate_loads/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ "ELECTRICITY", {
  "type" : "MultiPolygon",
  "type" : "MultiPolygon",
  "coordinates" : [ [ [ [ 658636.7618515313, 6799461.8964563515 ], [ 658636.7618515313, 6799434.882245781 ], [ 658679.2801103322, 6799434.882245781 ], [ 658679.2801103322, 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 ] ] ] ]
}, [ "PARK", "SOCIAL", "ROAD" ], 92, 94, [ 1, 2, 3 ], [ 1, 2, 3 ], false ]
}, [ "SOCIAL", "NORMAL", "LUXE" ], 1, 1, [ 1, 2, 3 ], [ 1, 2, 3 ], true ]
</pre>
'
{{article end|seealso=*[[api session event editor netload]]
</syntaxhighlight>
*[[api session items netloads]]
JavaScript example POST
<syntaxhighlight lang="text" copy>var options = {
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ "ELECTRICITY", { "type" : "MultiPolygon", "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]}, "SOCIAL", 1, 1, 1, 1, true ]'
};
fetch("https://engine.tygron.com/api/session/event/editornetload/generate_loads/?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/generate_loads/

Description: Generate Net Loads with a provided Net Type, for Addresses of Buildings inside the provided Polygons, for Buildings of the provided Category and Stakeholders and optionally only for Buildings without Net Loads. Addresses are bundled into one Net Load given a bundle threshold. Net Loads are set as Collective given another threshold. Stakeholder owning the Net Load can be mapped from the Building owner to a different one using the mappingIDs

Index Importance Type Description Values
0 REQUIRED (Enumeration) Net Type ELECTRICITY, GAS, HEAT, INTERNET or SEWER
1 REQUIRED (MultiPolygon with crs: EPSG:3857) Region
2 REQUIRED (Category or multiple values in array [a, b, c]) Building Categories
3 REQUIRED (Integer number) Bundle Threshold
4 REQUIRED (Integer number) Collective Threshold
5 REQUIRED (STAKEHOLDER Integer ID or multiple integer values in array [1, 2, 3]) Stakeholders (Building owners)
6 REQUIRED (STAKEHOLDER Integer ID or multiple integer values in array [1, 2, 3]) Stakeholders (mapped)
7 REQUIRED (true, false) Skip Buildings with Net Loads true or false

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/generate_loads/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ "ELECTRICITY", {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
}, "SOCIAL", 1, 1, 1, 1, true ]
'

Curl example multi item POST

curl 'https://engine.tygron.com/api/session/event/editornetload/generate_loads/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ "ELECTRICITY", {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
}, [ "SOCIAL", "NORMAL", "LUXE" ], 1, 1, [ 1, 2, 3 ], [ 1, 2, 3 ], true ]
'

JavaScript example POST

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