In our system, we follow the restful design practice. We have two resources say "shop" and "product", the "product" belong to the "shop".
At the beginning, the product's Id is unique only in the same shop context. And the url is something like "http://xxx/api/shops/1/products/1".
IMO, the above url is very informative.
However, after some discussion, the product's id is redesigned, and it becomes globally unique, the url is also changed to "http://xxx/api/products/1".
What's more, currently, nearly every resource is designed to have a globally unique id. And nearly every resource's url is something like "http://xxx/api/{resource}s/id"
IMO, there're some code smells for such design. But I'm not very clear about the pros and cons.
Aucun commentaire:
Enregistrer un commentaire