4 ms·
I have no skin in this game, but... 1) This is more of a client implementation issue than a GraphQL issue; there's nothing about the GraphQL spec that mentions
by seangrogg 8y ago
I have no skin in this game, but...
1) This is more of a client implementation issue than a GraphQL issue; there's nothing about the GraphQL spec that mentions what HTTP method to use. Most people use POST because it makes the most sense in the general case but there's no reason you can't move the query from a POST body to a GET query string.
2) This question seems odd to me. The real win from GraphQL is a reduction in overfetching - if you're tailoring a REST endpoint specifically to your needs the response should be functionally identical to a GraphQL response (i.e. only the data you need). These are just paradigms for passing data - the one you choose shouldn't have much impact on how said data is used.
- Someone 8y ago”there's no reason you can't move the query from a POST body to a GET query string.” There’s disagreement on whether it is within the http spec (https://stackoverflow.com/questions/978061/http-get-with-request-body https://stackoverflow.com/questions/978061/http-get-with-req...), but you can also send a body with a GET request, and you wouldn’t be alone in that; Elastic uses it, too (https://www.elastic.co/guide/en/elasticsearch/reference/current/search-request-body.html https://www.elastic.co/guide/en/elasticsearch/reference/curr...)
- merb 8y agowell you do not need a request body, you can actually put a json string into a get query string. something like: example.com?body=%7B%22hello%22%3A%22world%22%7D it's wierd, but I've seen that a lot.
- seangrogg 8y agoYeah, I originally was going to put that into my reply but I figured talking about the fact that GET bodies are technically doable would open its own can of worms.