B
B
bozuriciyu2019-10-06 01:30:57
API
bozuriciyu, 2019-10-06 01:30:57

POST to get data?

I would like to make a more efficient API, the application is growing, and already there are about a dozen requests for different REST API endpoints only when the application is initialized. I would like to combine them all into one. at the same time, there is no desire to get off GraphQL at all.
How bad is it to use POST to get data and pass parameters in the body? I don't like the solution with query params, it's not so convenient.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitsliputsli, 2019-10-06
@Vitsliputsli

How bad is it to use POST to get data and pass parameters in the body?

Fielding, when describing the REST architecture, did not say a word about http methods. On the other hand, http methods are so general that there is no "correct" usage to speak of, but it's still more common to use GET to get. By using POST you run the risk of misunderstanding the people who will maintain this code. But why?

X
xmoonlight, 2019-10-06
@xmoonlight

POST - great, especially for a dozen requests and, because this approach is already used in GraphQL, it is unambiguously correct.
I would do exactly this using a JSON container.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question