uri - E-Commerce REST API for categories -
in e-commerce project, building set of rest apis list categories , products catalog management system. category can have sub-categories , product can belong category or stand itself.
- root_category - sub_category - product1 - product2 - product3
here in example, root_category
contains sub_category
& product2
. subcategory
contains product1
. product3
doesn't belong category.
here possible use cases:
- list products in system.
/products
- get product details id.
/products/{id}
- search products id, name or description (need query 1 of these criteria)
/products?searchtem={searchterm}&q=[byid|byname|bydescription]
- list categories in system.
/categories
5(a). list sub categories belonging particular category.
/categories/{id}/categories
5(b). list root level categories. (eg. root_category
).
/categories/@root/categories
6(a). list products belonging category.
/categories/{id}/products
6(b). list products don't belong category. ie., root level products (eg. product3
).
/categories/@root/products
please let me know comments , suggest improvements these rest uris listed above. little concerned 5(b) , 6(b).can uris designed in better way.
i think looks reasonable, issue have use of category id.
i prefer see category name used, more user-friendly.
category name has unique obviously.
Comments
Post a Comment