Skip to content

Webhooks

AFS Energy Portal uses webhooks to let your application know when events happen such as updating of price.

List of events

You should provide only events that are specified in the table below.

NameDescription
price_updatedOffer that contains price has been created and will be sent to the client

Object structure

PropertyTypeDescriptionNullable
idStringUUIDNo
urlStringAFS Energy Portal will use this url to send request to client after certain event occursNo
eventStringName of event. See list of events.No

POST Create a Webhook

POST /api/webhooks

This endpoint allows you to create a Webhook.

Parameters

No parameters

Request header should contain Content-Type: application/json and Accept: application/json.

Request body

PropertyTypeDescriptionNullable
urlStringAFS Energy Portal will use this url to send request to client after certain event occursNo
eventStringName of event. See list of events.No

Example:

{
"url": "string",
"event": "price_updated"
}

GET Retrieve all Webhooks

GET /api/webhooks

This endpoint allows you to retrieve the list of Webhooks.

Parameters

No parameters

Request header should contain Accept: application/json.

GET Retrieve the Webhook

GET /api/webhooks/<id>

This endpoint allows you to retrieve the Webhook by id.

Parameters

PropertyTypeDescriptionNullable
idStringUUIDNo

Request header should contain Content-Type: application/json.

PUT Replace the Webhook

PUT /api/webhooks/<id>

This endpoint allows you to replace the Webhook by id.

Parameters

PropertyTypeDescriptionNullable
idStringUUIDNo

Request header should contain Content-Type: application/json and Accept: application/json.

Request body

PropertyTypeDescriptionNullable
urlStringAFS Energy Portal will use this url to send request to client after certain event occursNo
eventStringName of event. See list of events.No

Example:

{
"url": "string",
"event": "price_updated"
}

Request by price_updated event

POST <webhook.url>

Offer that contains price was created so the price_updated event occurred. AFS Energy Portal will send a request with Offer details to the client endpoint using url that was saved in the Webhook resource.

Parameters

No parameters

Request header will contain Content-Type: application/json.

Request body

PropertyTypeDescriptionNullable
idStringInternational Resource Identifier of OfferNo
priceFloatPrice per volumeNo
totalPriceFloatNotional priceNo
currencyStringCurrency code, for example, EUR or GBPNo
createdAtStringDate and time of Offer creation. Atom format (Y-m-d\TH:i:sP )No

Example:

{
"ioiIri": "/api/iois/1eef674e-3698-6450-82fb-5922191c8bd3"
"offerIri": "/api/offers/1eef674e-3698-6450-82fb-5922191c8aa1",
"price": 100.55,
"totalPrice": 10005.5,
"currency": "EUR",
"createdAt": "2024-03-28T12:36:17+00:00"
}

Responses

AFS Energy Portal expects successful response code 200.