C
C#2y ago
reeeeeee

❔ "proper" structure of the PUT endpoint

Whats better / more "proper" PUT request - PUT api/controller/{ID} and then objectDTO in body - PUT api/controller and in body objectDTO with included ID
3 Replies
Pobiega
Pobiega2y ago
The first option. PUT is "create or overwrite the specified resource, given by its URI"
cumslvt13
cumslvt132y ago
slightly unrelated question, but maybe you know some libraries that add allow whole model be bound both from route and body? For example, if I use CQRS in my app and I want to accept UpdateEntityCommand in the endpoint. But since id is passed in route there should be intermediate model or assignment after binding from body
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.