Akka Jaworek Akka Jaworek - 1 year ago 100
HTTP Question

GET method with list of paramethers as body or POST method?

I need to create an endpoint which will provide list of objects, i need to pass as request body list of ID's of objects i want to retrieve. As far i know this should be done by GET method since its only retrieving object and not modifying them, but when i want to call it from client side using

, it does not have any method for
to pass body. However this is archiveable with
method. Should i use
instead of
or is there other solution?

EDIT:for everyone with simmilar problem, this theard helps a lot:

HTTP GET with request body

Answer Source

If you want to stick to GET which is semantically more correct you need to pass the list of IDs as a Request parameter instead of body because GET doesn't define a body.

Using POST in which case you can pass the list in the body, is generally fine also though some sticklers will state that it isn't semantically correct.

Note that POST is sometimes preferred depending how complex or long the query data is.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download