In an actual deployment, the proper endpoints should be used, but it is also possible to test through Swagger. Here we illustrate the intended flow of the service.
/api/networks/n1with a network JSON file in the request body to load a power network and name it
/api/networks/n1/analysiscan optionally be called to analyse the loaded network and flag any issues with the network structure that might cause problems for the optimization.
/api/sessions/s1to create a session with id
s1and give a forecast JSON file in the request body. Here, a start configuration JSON file may also be given.
truein the request body to start the optimization.
- Wait a minute or so. The optimizer works iteratively, and the current state can be polled with GET
/api/sessions/s1or (for more detail) GET
- When a solution is desired, it can be retrieved with GET
- To halt the solver work, PUT
falsein the request body.
See also the full API reference.
How to authenticate with the Power Grid Optimizer API
When using the Power Grid Optimizer API, you are required to pass a bearer token along with your requests. The bearer token is received from a separate authentication endpoint in Azure.
To acquire a bearer token, send a POST request to
https://login.microsoftonline.com/061e3366-f8d3-4124-83e5-7c78e66a78db/oauth2/v2.0/token . The body should consist of form data with the following fields:
client_id: (Obtained from SINTEF)
client_secret: (Obtained from SINTEF)
The response will be JSON containing an access token under the key “
access_token“. When sending requests to Power Grid Optimizer endpoints, add the token to the Authorization header, preceeded by the word “
Bearer” like so:
Authorization: Bearer <token>
This header should be added to all HTTP API requests, both on SINTEFs cloud instance and on locally deployed Docker image instances.