Api session event editor netcluster generate clusters: Difference between revisions

From Tygron Support wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
API Event to Generate Clusters
API Endpoint to Generate Clusters
{|class=wikitable
{|class=wikitable
!Name
!Name
Line 75: Line 75:
Curl Example POST:
Curl Example POST:


<syntaxhighlight lang="text" copy>curl 'https://development.tygron.com/api/session/event/editornetcluster/generate_clusters/?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/editornetcluster/generate_clusters/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ "ELECTRICITY", "PER_LOAD", {
[ "ELECTRICITY", "PER_LOAD", {
  "type" : "MultiPolygon",
  "type" : "MultiPolygon",
  "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
  "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
}, 1, 91, 1, "Text", true, "" ]
}, 1, 81, 1, "Text", true, "" ]
'
'
</syntaxhighlight>
</syntaxhighlight>
Curl Example multi item POST:
Curl Example multi item POST:


<syntaxhighlight lang="text" copy>curl 'https://development.tygron.com/api/session/event/editornetcluster/generate_clusters/?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/editornetcluster/generate_clusters/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ [ "ELECTRICITY", "GAS", "HEAT" ], "PER_LOAD", {
[ [ "ELECTRICITY", "GAS", "HEAT" ], "PER_LOAD", {
  "type" : "MultiPolygon",
  "type" : "MultiPolygon",
  "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
  "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
}, [ 1, 2, 3 ], 91, 1, "Text", false, "" ]
}, [ 1, 2, 3 ], 68, 1, "Text", true, "" ]
'
'
</syntaxhighlight>
</syntaxhighlight>
Line 96: Line 96:
 method: "POST",
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ "ELECTRICITY", "PER_LOAD", { "type" : "MultiPolygon", "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]}, 1, 91, 1, "Text", true, "" ]'
 body: '[ "ELECTRICITY", "PER_LOAD", { "type" : "MultiPolygon", "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]}, 1, 81, 1, "Text", true, "" ]'
};
};
fetch("https://development.tygron.com/api/session/event/editornetcluster/generate_clusters/?crs=3857", options)
fetch("https://engine.tygron.com/api/session/event/editornetcluster/generate_clusters/?crs=3857", options)
 .then(response => response.text())
 .then(response => response.text())
 .then(result => console.log(result))
 .then(result => console.log(result))

Revision as of 09:07, 10 April 2026

API Endpoint to Generate Clusters

Name Importance Type Description Values
0 REQUIRED (NetType or multiple values in array [a, b, c]) NetType[]
1 REQUIRED (Enumeration) ClusteringType ADD_TO_EXISTING_FOR_BUILDINGS, MAP_SECTORS, PER_ATTRIBUTE, PER_BUILDING, PER_LOAD or PER_LOAD_UNIQUE_OWNER
2 REQUIRED (MultiPolygon with crs: EPSG:3857) MultiPolygon
3 REQUIRED (Integer number or multiple values in array [1, 2, 3]) Integer[]
4 REQUIRED (Floating point number) Double
5 REQUIRED (STAKEHOLDER Integer ID) Stakeholder
6 REQUIRED (String) String
7 REQUIRED (true, false) Boolean true or false
8 OPTIONAL (Floating point number) Double

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

Curl Example multi item POST:

curl 'https://engine.tygron.com/api/session/event/editornetcluster/generate_clusters/?crs=3857' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '
[ [ "ELECTRICITY", "GAS", "HEAT" ], "PER_LOAD", {
 "type" : "MultiPolygon",
 "coordinates" : [ [ [ [ 658636.762, 6799451.896 ], [ 658636.762, 6799461.896 ], [ 658646.762, 6799461.896 ], [ 658646.762, 6799451.896 ], [ 658636.762, 6799451.896 ] ] ] ]
}, [ 1, 2, 3 ], 68, 1, "Text", true, "" ]
'

JavaScript Example POST:

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