3

I want to query my data from Directus through GraphQL. I have to two collections Festival and Artists which are connected through a many to many relation. In the GUI everything works fine but when I try to query the records through GraphQL I'm not able to retrieve any fields from the related collection. My query looks like this:

query FestivalList($size: Int = 2, $skip: Int = 0) {
    model: festival(limit: $size, offset: $skip) {
        data {
            festivalId
            name
            artists {
                name
            }
        }
    }
}

As response I get following error: Cannot query field "name" on type "FestivalArtistItem".

So how should I query the related data through GraphQL? I'm using Directus 8.8.1

Cilenco
  • 6,951
  • 17
  • 72
  • 152
  • I know there were some far-reaching issues with GraphQL in Directus 8... have you tried Directus 9 (on Node)? That implementation is far more stable and feature-rich. https://www.npmjs.com/package/directus – RANGER Nov 20 '20 at 14:50
  • 1
    Yes I installed v9 rc15 but the documentation is still under development and I'm not sure how to access the GraphQL endpoint – Cilenco Nov 20 '20 at 15:47
  • The API reference is coming this week... I'd check back in a few days. – RANGER Nov 23 '20 at 00:16

0 Answers0