T
T
tamtakoe2019-06-14 21:02:58
RESTful API
tamtakoe, 2019-06-14 21:02:58

Should I pass GET parameters in a POST request?

We have a REST API or something close to it and we need to create/delete/update a specific resource whose id we don't know (or doesn't exist at all), but which can be accessed like this:
GET `/resource?channelId=channelId&locationId= locationId&serviceType=serviceType`
Of course, you can do this:
POST `/resource/channel/:channelId/location/:locationId/service-type/:serviceType`
but it looks weird.
Does it make sense to pass query parameters in a post request to identify a resource, or how would you do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
�
âš¡ Kotobotov âš¡, 2019-06-14
@angrySCV

yes, it’s a normal option with a POST request, in addition, I note that they still use specific types of requests -> POST to create, to delete Delete, to update a small part of the PUT data (Post for full creation / update), well, GET to request data, there is more methods but for most of these methods is completely enough.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question