I am currently developing a REST API.
I am developing an API that returns products related to a user, and an API that returns products related to a product.
I cannot be sure how to configure the url correctly.
What I find controversial is that in the case of a URL returning a list of products through the product, these products are re-listed.
Please tell me a good URL pattern.
I am considering the following options.
1.
/domain/v1/relatedProducts/users/{userId}
/domain/v1/relatedProducts/products/{productId}
2.
/domain/v1/user/{userId}/relatedProducts
/domain/v1/products/{productId}/relatedProducts
3. Please provide other URL patterns.
source
share