datenguide / datenguide-api

datenguide GraphQL API Server
MIT License
10 stars 2 forks source link

Graphql - How to query all regions in 'DG' (All german regions?) #1

Closed P3nny closed 5 years ago

P3nny commented 5 years ago

To be able to compare all regions in germany, I wold like to query all the regions in all federal states:

{ allRegions(page: 0, itemsPerPage: 10) { regions(parent: "DG", nuts:3) { id name BILABS(BILAG2: BILABS11, year: 2015, GES: [GESM, GESW, GESAMT]) { year BILAG2 GES value } } page itemsPerPage total } }

OUTPUT: { "data": { "allRegions": { "regions": [], "page": 0, "itemsPerPage": 10, "total": 0 } } }

Is my query wrong? Or is this a bug?

simonwoerpel commented 5 years ago

The parent parameter is for filtering for sub-regions, e.g. "All the Kreise & kreisfreie Städte in Nordrhein-Westfalen". If you want all regions, there is no parent needed.

just without parent, this is the same query for all landkreise (that works :)):

{
  allRegions(page: 0, itemsPerPage: 10) {
    regions(nuts: 3) {
      id
      name
      BILABS(BILAG2: BILABS11, year: 2015, GES: [GESM, GESW, GESAMT]) {
        year
        BILAG2
        GES
        value
      }
    }
    page
    itemsPerPage
    total
  }
}