Api session event logic set net setting boolean

From Tygron Support wiki
Jump to navigation Jump to search

API Endpoint: api/session/event/logic/set_net_setting_boolean/

Description: For boolean valued Net Settings (ELECTRICITY_ACTIVE, GAS_ACTIVE, HEAT_ACTIVE, INTERNET_ACTIVE, SEWER_ACTIVE, REQUIRE_UTILITY_CORPORATION_APPROVAL, CLUSTER_MODELS_ENABLED, LOAD_TO_NODE_LINES_ENABLED, FIRST_CONNECT_ACCEPT, RESTRICT_TO_NET_Overlay), set the value to true or false.

Name Importance Type Description Values
0 REQUIRED (Type or multiple values in array [a, b, c]) Net Setting Type
1 REQUIRED (Boolean or multiple values in array [true, false, true]) 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/logic/set_net_setting_boolean/' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '[ "CLUSTER_FRACTION_CONNECTED", true ]'

Curl example multi item POST:

curl 'https://engine.tygron.com/api/session/event/logic/set_net_setting_boolean/' -H 'Content-Type: application/json' -H 'Authorization: Bearer API_TOKEN' -d '[ [ "CLUSTER_FRACTION_CONNECTED", "REQUIRE_UTILITY_CORPORATION_APPROVAL", "CLUSTER_MODELS_ENABLED" ], [ true, false, true ] ]'

JavaScript example POST:

var options = {
 method: "POST",
 headers: { "Content-Type": "application/json", "Authorization": "Bearer API_TOKEN" },
 body: '[ "CLUSTER_FRACTION_CONNECTED", true ]'
};
fetch("https://engine.tygron.com/api/session/event/logic/set_net_setting_boolean/", options)
 .then(response => response.text())
 .then(result => console.log(result))
 .catch(error => console.log('error', error));