I was reading some documents about the appropriate use of URI\'s using rest services and I came across an example for basic GET .. DELETE requests.
The example uri\'
Another benefit for including id in URL for put request is CREATE/UPDATE function can share some logic.
Let's say you have this user table with 3 colums.
id(primary key, auto increment) | name | age
Creating a user will generate a ID.
POST /users
{
name: "foo"
age: 25
}
-> generate id 123
Because id is in URL, you can use the same request body structure for updating a user.
PUT /users/123
{
name: "bar"
age: 25
}
This might be not so related to REST principal, but it could simplify the code for request handling in practice depending on your languages/frameworks.