Sites
Sites are the core of our new decentralised power grids, representing households, office buildings, and other facilities. Each site includes a meter (head meter, digital meter), which enables grid operators and suppliers to monitor energy usage and facilitate appropriate remuneration.
The activities recorded by these meters are crucial for providing flexibility in the grid. Adjusting consumption or production at these points helps maintain grid stability.
Identifiers​
Each site is identified by a unique identifier, known to both the supplier and grid operators. This identifier is specific to the end-consumer and varies by country. Below is an overview of these identifiers by region.
Country | Identifier |
---|---|
Belgium | EAN |
Netherlands | EAN |
Luxembourg | EAN |
France | PRM |
United Kingdom | MPAN |
Ireland | MPRN |
Italy | POD |
Spain | CUPS |
A site identifies a single head (digital) meter. In case you have multiple head meters, you should register these as multiple sites.
Managing​
In order to start benefiting from extra flexibility, a site needs to be created.
Creating​
To create an endpoint, you need at least its identifier.
- Python
- JavaScript
- Java
- Go
- C#
- cURL
import requests
import json
url = "https://api.powernaut.io/v1/connect/sites"
payload = json.dumps({
"location": {
"address": "Dok Noord, Gent, Belgium"
},
"supply_points": [
{
"grid_identifier": "EAN1234567890",
"direction": "bidirectional"
}
]
})
headers = {
'Content-Type': 'application/json',
'Accept': 'application/json',
'Authorization': 'Bearer <token>'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer <token>");
const raw = JSON.stringify({
"location": {
"address": "Dok Noord, Gent, Belgium"
},
"supply_points": [
{
"grid_identifier": "EAN1234567890",
"direction": "bidirectional"
}
]
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow"
};
fetch("https://api.powernaut.io/v1/connect/sites", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\"location\":{\"address\":\"Dok Noord, Gent, Belgium\"},\"supply_points\":[{\"grid_identifier\":\"EAN1234567890\",\"direction\":\"bidirectional\"}]}");
Request request = new Request.Builder()
.url("https://api.powernaut.io/v1/connect/sites")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer <token>")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.powernaut.io/v1/connect/sites"
method := "POST"
payload := strings.NewReader(`{"location":{"address":"Dok Noord, Gent, Belgium"},"supply_points":[{"grid_identifier":"EAN1234567890","direction":"bidirectional"}]}`)
client := &http.Client {
}
req, err := http.NewRequest(method, url, payload)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer <token>")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.powernaut.io/v1/connect/sites");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var content = new StringContent("{\"location\":{\"address\":\"Dok Noord, Gent, Belgium\"},\"supply_points\":[{\"grid_identifier\":\"EAN1234567890\",\"direction\":\"bidirectional\"}]}", null, "application/json");
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl --location 'https://api.powernaut.io/v1/connect/sites' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--data '{"location":{"address":"Dok Noord, Gent, Belgium"},"supply_points":[{"grid_identifier":"EAN1234567890","direction":"bidirectional"}]}'
Deleting​
You can also delete a site, for example when you are no longer serving this end-consumer.
- Python
- JavaScript
- Java
- Go
- C#
- cURL
import requests
url = "https://api.powernaut.io/v1/connect/sites/<uuid>"
payload = {}
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <token>'
}
response = requests.request("DELETE", url, headers=headers, data=payload)
print(response.text)
const myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer <token>");
const requestOptions = {
method: "DELETE",
headers: myHeaders,
redirect: "follow"
};
fetch("https://api.powernaut.io/v1/connect/sites/<uuid>", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.powernaut.io/v1/connect/sites/<uuid>")
.method("DELETE", body)
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer <token>")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.powernaut.io/v1/connect/sites/<uuid>"
method := "DELETE"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer <token>")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Delete, "https://api.powernaut.io/v1/connect/sites/<uuid>");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl --location --request DELETE 'https://api.powernaut.io/v1/connect/sites/<uuid>' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>'
Listing​
You can fetch a single site using its ID, or just list all of them:
- Python
- JavaScript
- Java
- Go
- C#
- cURL
import requests
url = "https://api.powernaut.io/v1/connect/sites?page=1&page_size=10"
payload = {}
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer <token>'
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
const myHeaders = new Headers();
myHeaders.append("Accept", "application/json");
myHeaders.append("Authorization", "Bearer <token>");
const requestOptions = {
method: "GET",
headers: myHeaders,
redirect: "follow"
};
fetch("https://api.powernaut.io/v1/connect/sites?page=1&page_size=10", requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.powernaut.io/v1/connect/sites?page=1&page_size=10")
.method("GET", body)
.addHeader("Accept", "application/json")
.addHeader("Authorization", "Bearer <token>")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://api.powernaut.io/v1/connect/sites?page=1&page_size=10"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Authorization", "Bearer <token>")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "https://api.powernaut.io/v1/connect/sites?page=1&page_size=10");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer <token>");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
curl --location 'https://api.powernaut.io/v1/connect/sites?page=1&page_size=10' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>'
Now that we've learned how to register sites, let's continue by registering flexible resources for this site.