-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Important
The new huslejenaevn.dk, including GraphQL API, will be released in late 2024 and will only then be accessible for external parties.
Huslejenaevn.dk uses GraphQL as a query language for the API exposing resources in regards to published decisions (da: offentliggjorte afgørelser) made by the Rent boards (da: huslejenævn) and Resident complaints boards (beboerklagenævn) in the municipalities of Denmark.
Anyone can request access to these resources as they are publicly available but it requires obtaining an API key. Please contact naevn@sbst.dk for obtaining such an API key. You will need to provide contact information and your purpose of access to these resources.
The GraphQL API are available at:
For testing purposes you can use a GraphQL client such as:
The API key must be provided as a custom HTTP Header named X-API-KEY.
For a generic introduction to querying data with GraphQL we recommend to read:
The most simple query object in huslejenaevn.dk is the municipality query object. It returns a list of municipalities which is of type Municipality with two fields, municipalityCode and name.
Using an API client, such as Postman or Insomnia, the list of municipalities can be queried like this (remember to provide a valid API key as the custom HTTP header named X-API-KEY):
query {
municipalities{
municipalityCode
name
}
}It will return JSON such as:
{
"data": {
"municipalities": [
{
"municipalityCode": "0510",
"name": "Haderslev Kommune"
},
...
{
"municipalityCode": "0360",
"name": "Lolland Kommune"
}
]
}
} For filtering and sorting data, GraphQL API for huslejenaevn.dk uses Input types in order to group a set of arguments together, and then be used as an argument to another field.
As an example, if the list of municipalities should be filtered to only municipalities with letters "Ka" in the name, it can be queried like this:
query {
municipalities (where: {name: {contains: "Ka"}}) {
municipalityCode
name
}
}Which returns:
{
"data": {
"municipalities": [
{
"municipalityCode": "0326",
"name": "Kalundborg Kommune"
},
{
"municipalityCode": "0746",
"name": "Skanderborg Kommune"
},
{
"municipalityCode": "0756",
"name": "Ikast-Brande Kommune"
}
]
}
}where and order arguments are usually available for all types and fields. It is also possible to use and and or with multiple arguments such as:
query {
municipalities(
where: {
or: { municipalityCode: { contains: "03" }, name: { contains: "La" } }
}
) {
municipalityCode
name
}
}Which returns:
{
"data": {
"municipalities": [
{
"municipalityCode": "0330",
"name": "Slagelse Kommune"
},
{
"municipalityCode": "0360",
"name": "Lolland Kommune"
}
]
}
}This hopefully provides an overall understanding of the GraphQL API for huslejenaevn.dk.
Read more about querying the GraphQL API for huslejenaevn.dk on the Best Practices and Queries pages.