curl --request POST \
--url https://api.eddy.engineer/v1/power.edit \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"edits": [
{}
],
"include_document": true,
"network": {},
"network_key": "<string>",
"project": "<string>",
"variant": "<string>"
}
'import requests
url = "https://api.eddy.engineer/v1/power.edit"
payload = {
"edits": [{}],
"include_document": True,
"network": {},
"network_key": "<string>",
"project": "<string>",
"variant": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
edits: [{}],
include_document: true,
network: {},
network_key: '<string>',
project: '<string>',
variant: '<string>'
})
};
fetch('https://api.eddy.engineer/v1/power.edit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eddy.engineer/v1/power.edit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'edits' => [
[
]
],
'include_document' => true,
'network' => [
],
'network_key' => '<string>',
'project' => '<string>',
'variant' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.eddy.engineer/v1/power.edit"
payload := strings.NewReader("{\n \"edits\": [\n {}\n ],\n \"include_document\": true,\n \"network\": {},\n \"network_key\": \"<string>\",\n \"project\": \"<string>\",\n \"variant\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.eddy.engineer/v1/power.edit")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"edits\": [\n {}\n ],\n \"include_document\": true,\n \"network\": {},\n \"network_key\": \"<string>\",\n \"project\": \"<string>\",\n \"variant\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/v1/power.edit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"edits\": [\n {}\n ],\n \"include_document\": true,\n \"network\": {},\n \"network_key\": \"<string>\",\n \"project\": \"<string>\",\n \"variant\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}Apply edit verbs to a power network document: the new document, each step's hash and the undo
Build or change a network without a project. edits are applied in order, each a verb of the document’s own vocabulary: {edit: add, element: {type, value}} (type: bus, source, branch, shunt, load, motor, device, case), {edit: remove, id} (refused while something refers to the element, naming what), {edit: replace, element}, {edit: set, id, field, value} (field a JSON pointer inside the element, such as /nominal_v or /model/tap/position; null clears an optional field), {edit: set_switch, id, closed}, {edit: set_in_service, id, in_service}, {edit: set_network, field, value} (name, frequency_hz, base_va), {edit: load, network}. An edit keeps the document readable; whether the network makes sense is validation’s, so edits may arrive in any order. Answers the new document’s key and document, initial_key, episode (ss.power.episode/1: each edit with the hash after it), episode_key and undo (the verbs that restore the initial document, in order). Nothing is written to a project: a project’s document is edited through its live chain (/v1/projects/{id}/live.append) with the same verbs. Refused: POWER_EDIT_INVALID (400: the edit and why, with its index), POWER_CAP (413: more than 10,000 edits), and power_network’s refusals.
curl --request POST \
--url https://api.eddy.engineer/v1/power.edit \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"edits": [
{}
],
"include_document": true,
"network": {},
"network_key": "<string>",
"project": "<string>",
"variant": "<string>"
}
'import requests
url = "https://api.eddy.engineer/v1/power.edit"
payload = {
"edits": [{}],
"include_document": True,
"network": {},
"network_key": "<string>",
"project": "<string>",
"variant": "<string>"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
edits: [{}],
include_document: true,
network: {},
network_key: '<string>',
project: '<string>',
variant: '<string>'
})
};
fetch('https://api.eddy.engineer/v1/power.edit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.eddy.engineer/v1/power.edit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'edits' => [
[
]
],
'include_document' => true,
'network' => [
],
'network_key' => '<string>',
'project' => '<string>',
'variant' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.eddy.engineer/v1/power.edit"
payload := strings.NewReader("{\n \"edits\": [\n {}\n ],\n \"include_document\": true,\n \"network\": {},\n \"network_key\": \"<string>\",\n \"project\": \"<string>\",\n \"variant\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.eddy.engineer/v1/power.edit")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"edits\": [\n {}\n ],\n \"include_document\": true,\n \"network\": {},\n \"network_key\": \"<string>\",\n \"project\": \"<string>\",\n \"variant\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.eddy.engineer/v1/power.edit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"edits\": [\n {}\n ],\n \"include_document\": true,\n \"network\": {},\n \"network_key\": \"<string>\",\n \"project\": \"<string>\",\n \"variant\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}{
"error": {
"code": "INVALID_GEOMETRY",
"message": "<string>"
}
}Body
Response
key, initial_key, episode_key, episode, undo, counts, cases, validation, document
The response is of type object.