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\'
PUT http://example.com/api/users + body behaves like the put of a map with the key http://example.com/api/users and the value the body. A new entry is created if none exists, else the existing one is overridden.
Question: what is the resource behind http://example.com/api/users ?
Answer: the same than the one provided by GET http://example.com/api/users, the list of all users.
So, the command PUT http://example.com/api/users means that you replace the list of all users with the one you provide.
For consistency, the body should contain an array of users:
[
{
Id: 1,
FirstName: 'John',
LastName: 'Doe'
},
{
Id: 2,
FirstName: 'Albert',
LastName: 'Einstein'
}
]