In the current project, let "toys" be the category and "gun" be the product. The ID for the toys category is 2 and ID for the gun product is 1.
The URI for categories is
The URI for products is
So we have the category toys at:
/api/v1/categories/2 and we have the product gun at:
For deleting a specific product, we have to make a DELETE request to the specific product URI, e.g.
But for creating the product, we have to go to
/api/v1/product/2 and create a product with a name, and price, and the product resource ID (2 in the given URI) is actually the category ID.
So in this example, if I use
.../product/2, then the product is created under the toys category as toys is the category with ID 2.
But I raised an objection and recommended that to create a toy under a category then the POST action should be under that category. In this example, for creating the product, we have to go to
/api/v1/categories/2 and create a product with a name, and price and the product will be created in the toys category.
But the developer insists that the implementation is correct, and it is a REST API and so the HATEOS for creating a product will be pointing to the
/api/v1/product/<category_id> so there is no need to do this under category resource itself.
As a QA what should be our response to such a design ?
Should it be ignored or are there are any good practices QA follows to ensure the quality of a REST endpoint?
What would be a good checklist for REST API validation ?