Skip to content

Simulating Events

In the Sandbox-environment you may trigger test events to test your integration. We also have dedicated test areas for locations in Sandbox, which have daily automatic sendouts of price curve events. This document outlines how to simulate events and test the delivery of these events to your webhooks.

Testing PriceCurve-events

When we create a price curve targeting any of your resources, our system generates a PriceCurve-event and sends a notification to all webhooks that subscribe to notification types that trigger on this event.

You can simulate a PriceCurve-event by making a POST request to the /simulation/events/priceCurve endpoint. Doing so will create the event in our database, send a notification to any relevant webhook endpoints, and make it available under the /events endpoint.

Request Headers

  • Content-Type: application/json
  • Accept: application/json
  • Authorization: Bearer YOUR_API_TOKEN

Request Body

Depending on your needs, you can specify the resources and locations for which you want to simulate the event or leave them blank, and we will pick them for you.

If you want our API to pick random resources and locations, you can use an empty request body:

{}

This will create a PriceCurve-event, and send a notification to your webhook endpoint, and make the event itself available under the /events endpoint.

If you want to specify the resources and locations, you can provide the following details in the JSON body of your request:

{
"targets": [
{
"resourceId": "id of the resource",
"locationId": "id of the location that the resource belongs to"
}
]
}

You can simulate specific values by specifying other parameters, such as priceArea and priceCurveDelta.

Description of the parameters:

  • targets: (Optional) An array of objects containing the resourceId and locationId of the resources and locations for which you want to simulate the event. They will be randomly picked from available resources and locations if not provided.
  • priceCurveDelta: (Optional) The price curve delta value for the event. There will be a randomly generated curve if not provided.
  • priceArea: (Optional) The price area for the event. Will randomly generate values if not provided.

Sample cURL Command

Terminal window
curl -X POST "{{baseUrl}}/simulation/events/priceCurve" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{
"targets": [{ "resourceId": "6f81de1", "locationId": "9fbb535" } ]
}'

Testing UserEligibility-events

When a user’s eligibility changes, our system generates a UserEligibility-event and sends a notification to all relevant webhooks that have subscribe to notification types that trigger when this event occurs.

You can simulate a UserEligibility-event by making a POST request to the /simulation/events/userEligibility endpoint. This will create the event in our database, send a notification to your webhook endpoint, and make it available under the /events endpoint. There is no request body for this call.

Request Headers

  • Authorization: Bearer YOUR_API_TOKEN

Sample cURL Command

Terminal window
curl -X POST "{{baseUrl}}/simulation/events/userEligibility" \
-H "Authorization: Bearer YOUR_API_TOKEN"

Testing actual eligibility changes

To have the user eligibility actually updated, you need to create or move an existing location inside an eligible neighbourhood. You can do this by either:

  • Set a MeterPointId (Mpid) at a location corresponding to a specific Mpid that our analysis has shown exists in an eligible Neighbourhood.
  • Or, has Coordinates set on it that land within that specific neighbourhood polygon/boundary box

The easiest way is to set the following coordinates on a location that lands inside of the test Neighbourhoods:

{
"coordinates": {
"latitude": 60.52485052347296,
"longitude": 5.060012082871939
}
}

This should make the user who owns the location eligible (after some processing time), and you should receive a notification for your UserEligibility-event.