When designing a rest API, the parameters are usually passed in url or body?

except for get requests, my current api is designed to pass parameters in body , and the background springmvc is received by @ requestbody.
my idea is: if all are passed in url, the backend needs to write multiple parameters one by one, which is very troublesome.
is this appropriate?


appropriate. Get mainly acquires specified resources based on a limited number of parameters, so even if you add paging sorting and so on, it won't have many parameters. Post requests are used to update and add data, and it is perfect to pass them on in body.


you can put some user identities in url and payload in body


method path Action Route name
GET / post index post.index
GET / post/create create post.create
POST / post store post.store
GET / post/ {post} show post.show
GET / post/ {post} / edit edit post.edit
PUT/PATCH / post/ {post} update post.update
DELETE / post/ {post} destroy post.destroy

Parameter suggests putting, restful api like this

Menu