/
Retrieve Data from the PQ Portal API

Retrieve Data from the PQ Portal API

If you have successfully retrieved your access token, you can test the API by sending a simple request. Every request your application sends to the PQ Portal API must include an authorization token. The token identifies your application to the PQ Portal.

On this page you will learn how to

Send a simple GET request to the PQ Portal API

When you send a request to the API, at least the following information needs to be given:

  1. The type of the request: GET, POST, PUT or DELETE

  2. The request URL

  3. A valid access token

  4. Depending on the endpoint: a request body

In this example we ask the API to give us infos about us as a user of the PQ Portal.

curl -X 'GET' \ 'https://training.pq-portal.energy/pqapi/data/v1/users/me/info' \ -H 'accept: application/json' \ -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIs...'

The response of the API will always consist of:

  1. A response code. If the API determines that your request and the token are valid, it returns “Success” and

  2. The response body, which in the case of the example holds the following information:

{ "id": "835f9820-ee14-4a1a-9a9d-1136a6cf246d", "internalPqId": 123, "firstName": "Henri", "lastName": "Tester", "email": "835f9820-ee14-4a1a-9a9d-1136a6cf246d", "energyMarketActor": { "id": "545379f6-a92a-4de9-bb02-548ac6fa4abd", "name": "Test GmbH", "shortName": "TEST", "types": [ "BalancingServiceProvider", "Contractor", "BalanceGroupResponsible" ] } }

Send a more complex GET request to the PQ Portal API

In this example we ask the API to give us the data of the energy market actors that act as TSOs. We need to specify the type of energy market actor in the URL via ‘types’ as the endpoints can give back information about different types of market actors. We also set the maximum limit of this request to the first element in the list.

curl -X 'GET' \ 'https://training.pq-portal.energy/pqapi/data/v1/energy-market-actors?types=TransmissionOperator&limit=1' \ -H 'accept: application/json' \ -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIs...'

The response holds the first TSO of the list of TSOs in Germany.

[ { "id": "9e9527f3-7983-4e84-9fcf-1e1b09522c3a", "name": "50Hertz Transmission GmbH", "shortName": "50Hertz Transmission", "roles": [ { "type": "TransmissionOperator", "bdewCode": "9911845000009" }, { "type": "DistributionOperator", "bdewCode": null }, { "type": "BalanceGroupResponsible", "bdewCode": null } ] } ]

The response also tells you the roles in the energy market that those TSO hold. If you would send the same request with the type filtered by DSO, your response would also include the TSO.

Identify a variety of entities via the PQ Portal API

When addressing different entities via the PQ Portal API each item responds to a unique ID. To access these IDs you can find different endpoints that give you all the information about an entity and also the corresponding ID. As you will need these IDs to reference these entities it is recommended to save them in your variables. In the following you will find a short description of some of the most important IDs and a possible (but not necessarily the only) way to retrieve the ID from the database.

Get all IDs

GET …/users/me/info

Every user is not identified by their name but by a ID that is assigned to them. This endpoint holds all the information about you and your permissions and also your unique ID.

GET …/energy-market-actors?types=TransmissionOperator

Every technical unit is located in one of the four control areas administered by the four German TSOs. This endpoint with the filter to types=TransmissionOperator enabled will give you all TSOs and the according IDs for the PQ Portal API.

GET …/energy-market-actors?types=BalancingServiceProvider

Every Balancing Service Provider has an unique ID to be identified by. As a Balancing Service Provider you will receive only your own ID when types=BalancingServiceProvider.

GET …/energy-market-actors?types=DistributionOperator

Every technical unit is associated to a Distribution Area that is administered by a Distribution Operator. This endpoint with the filter to types=DistributionOperator enabled will give you all DSOs and the according IDs for the PQ Portal API.

GET …/energy-market-actors?types=BalanceGroupResponsible

Balance Group Responsibles manage one Balance Group. This endpoint with the filter to types=BalanceGroupResponsible enabled will give you all Responsibles.

We differentiate between 3 types of reserve resources in the database: reserve units, reserve groups and technical units. You can access all these reserve resources via one endpoint by setting the corresponding filter in your request.

GET …/reserve-resources?types=ReserveUnit

GET …/reserve-resources?types=ReserveGroup

GET …/reserve-resources?types=TechnicalUnit

In that sense you can also filter the reserve resources by type of the reserve (FCR, aFRR, mFRR), by TSO or using the free text search.

 


Next steps