Hi there, hoping someone can help with a quick question!
I am using the GraphQuery API to access the data in my repo which works brilliantly, however there is one piece of data that I can't seem to access. It is a group of linked documents, in my content model the JSON looks like this, with the readers group clearly defined with customtypes applied.
And below is the Prismic GraphQuery I am using to access the name field. While it doesn't crash or exit with a 500 response it also doesn't return the appropriate data (the name field)! I'm hoping someone is able to help with this as I feel I've really wrestled with the docs to find an answer!
I'll be happy to help you with this. Could you please share with us the following info so we can run a test on our end?
The URL of your repository
The complete GraphQuery. I see that the object of the query starts from the Group fields API ID. There seems to be something missing at the beginning, that would be the name of the Custom Type. For example: { blog { } }
...which doesn't seem to give me a data property on individual readers (which would contain the name). If I swap it out for exactly what you have above, it doesn't seem to work at all? Is there something I'm missing from the syntax? Also to clarify, I'm trying to use this to retrieve all (>100) of the readings, not a single one (which is why I think the readings is necessary?)
Yes, the syntax is important because you need to use spaces instead of tabs when writing the query to avoid errors.
The query that I shared with you works, let me show you how to test it out in the API browser of your repository: https://hi-zero.prismic.io/api/v2
You need to click on Search documents first, and then you can start testing your GraphQueries. For example, to create the query that I showed you before (This one is returning the reading documents with the name field of the linked docs that you need. But please note that GraphQl will return only 20 results. You can allow up to 100 documents per page by using pagination) I used this tool to remove the whitespaces of the query and then used an encoder to paste it in the &graphQuery= param of the URL:
I still cannot resolve my query, I think it must be something to do with the way I am implementing the JS library – would it be possible to discuss this further?