Since I am new to GraphQL, I don't really know how to call a REST endpoint and query the fields accordingly. In particular, I want to fetch certain fields from the entire response of a GET API.
What I have learnt is GraphQL sends a POST request. How do I hit the GET endpoints ?
PS: we cannot use Apollo client in the project.
While trying to find the docs that say GraphQL works with POST, I found the docs that show it can work with GET too, if you pass the entire query in the
queryquery string parameter. The Serving over HTTP - GET Request section shows that this query :Can be sent using GET with :
Variables and operation names can be passed as additional parameters:
To test this, I created a new minimal GraphQL services using HotChocolate's Getting Started example and tried this in a new browser tab:
I got back a valid GraphQL response: