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:
The type of the request: GET, POST, PUT or DELETE
The request URL
A valid access token
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:
A response code. If the API determines that your request and the token are valid, it returns “Success” and
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