I have product_id and onec_id columns to get items from DB. Which API routes should I use to get items by product_id or by onec_id?
Is it right for REST routes?
GET /products/{product_id}
GET /products/get_by_onec_id/{onec_id}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The most REST solution is to fire one HTTP request for each id. For example
REST is intended to represent the state of a resource. It can return a set of items, but only if these items relate to each other in some way. For example
Will return the set of products associated with the specified onec.
If you want to return the set of products identified by a set of IDs in a single request, you may have your shortcut syntax like
But it’s not really common because it’s quite a departure from the REST objectives