Cancellation
Traders may choose to cancel the flexibility they requested. This means that your resources should no longer follow any particular setpoint. They can go back to their baseline, or default steering mode.
Powernaut uses the same endpoints that are used for activation to inform your resources about this change. To indicate that the activations were cancelled, it will send null
as setpoint.
MQTT​
The cancellation message is the same as an activation message but with null
as the value
for the setpoint.
The message is sent to the setpoint
topic (resource/{id}/commands/setpoint
) used for activation.
The message that will be sent to to indicate the cancellation looks like this:
{
"timing": {
"start": "2024-07-01T14:00:00Z",
"end": "2024-07-01T14:15:00Z"
},
"value": null
}
Please be mindful of the difference between {value: 0}
and {value: null}
.
The first one sets an explicit setpoint with the value 0
. The other one expects your resource to return to its baseline.
Webhooks​
When using webhooks, Powernaut sends the cancellation request to the same accepted
endpoint that was configured in either the resource's or bid's webhooks
settings.
The webhook will be called with the same message used in a regular activation.
{
"id": "5aaeae38-70f7-41e5-8e58-01b4d79fabb7"
}
This is the ID of the bid that has been accepted, you should look up the bid to receive the activation details as follows:
- Python
- JavaScript
- Java
- Go
- C#
- cURL
import requests
url = "https://api.powernaut.io/v1/connect/bids/5aaeae38-70f7-41e5-8e58-01b4d79fabb7"
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/bids/5aaeae38-70f7-41e5-8e58-01b4d79fabb7", 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/bids/5aaeae38-70f7-41e5-8e58-01b4d79fabb7")
.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/bids/5aaeae38-70f7-41e5-8e58-01b4d79fabb7"
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/bids/5aaeae38-70f7-41e5-8e58-01b4d79fabb7");
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/bids/5aaeae38-70f7-41e5-8e58-01b4d79fabb7' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>'
Up to this point, your webhook behaves exactly the same as in a regular activation flow
The activation details can be found in the activation
property of the response. Because this is a cancellation, the activation.value
will be null
.
{
activation: {
value: null,
},
resourceId: "6dcc8f5d-2786-4672-816c-5ce221db62f5",
// ... other fields for this bid
}
To ease the transition, Powernaut will include the baseline value during the first month after introducing the cancellation feature. This gives you time to update your integration logic. The change will be permanently adjusted at the end of May 2025.