Giving this naming convention:
http://www.restapitutorial.com/lessons/restfulresourcenaming.html
for the POST (insert) the url of the resource should follow this path/logic:
http://www.example.com/products/X123
{
"color":"something"
}
Is the following path conceptually wrong? and why is it correct/wrong?
http://www.example.com/products
{
"id":"X123"
"color":"something"
}
the ID is generated externally
Also for the PUT is it ok to apply the same logic? (the id naturally must not be changed but used only as ref)
Thank you
For POST (which is usually used to create a new item in collection) use the following:
http://www.example.com/products
{
"color":"something"
}
if you have a requirement where client generated the id, the it is
http://www.example.com/products
{
"id": "abc123"
"color":"something"
}
EDIT:
For PUT it should be:
http://www.example.com/products/abc123
{
"color":"something else"
}