How to get documents that reference a specific document in GET requests to the Sanity API.
Last updated: Oct 5, 2021
When making GET requests to the Sanity api, how can I get documents that reference a specific document? I've tried two different ways and I always get a 400 error (in my app and in Postman when making the same requests).
That did it! I just needed to encode the GROQ query ampersands. Didn't realize that I hadn't been using ampersands in my other requests so it wasn't a problem before. I'm using RTK Query to make the requests so I'll leave a sample of my code if it is helpful to anyone: