8
8
8bitjoey2015-03-11 23:45:11
RESTful API
8bitjoey, 2015-03-11 23:45:11

How to use REST correctly when you need to transfer a lot of data in GET?

There is a template service, you can pass a number of parameters to it, with which it will replace the corresponding placeholders in the template. On the one hand, getting the generated page is a GET request. But what if I have so many parameters that it won't fit in the URL? Use POST? In theory, this is incorrect. And in general, a request with a bunch of parameters in the URL looks unimportant.
I'd like to hear your thoughts on this.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
George, 2015-03-12
@BATC0H

Recently, there was an interesting discussion about REST on Habré , and in the comments I liked one option.
In your case, it will look something like this:
Request:
POST /TemplateVariant
{
[many parameters]
}
Response:
201 Created
Location: /TemplateVariant/58f523a2-79c1-475e-98ac-2e6dfa43abcc
Request #2:
GET /TemplateVariant/58f523a2-79c1-475e -98ac-2e6dfa43abcc
Answer #2:
200 OK
{
[done pattern]
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question