Which one of the following is a better Rest URL?
-
03-07-2021 - |
Domanda
Just a quick question. Which one of the following makes a better Rest API Url & why so?
GET shop/department/{id}/{action}
GET shop/department/{action}/{id}
The action is a verb and it can be:
GET shop/department/{id}/download
GET shop/department/{id}
GET shop/department/{id}/receive
Soluzione
If action
is an action as in Remote Procedure Call RPC, both are equally bad.
Actions don't belong in URLs but in HTTP verbs.
Altri suggerimenti
Use actions and corresponding id as parameter
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow