the purpose of this question is twofold. To determine how to return data to fill in dropdown lists in UI, and to determine the best practice in rest uri to support this.
Suppose you have an entity Car which has an attribute type.
This type attribute can be one of the following values
{ code : CPE, label : "Coupe"} { code : SPT, label : "Sports"} { code : LUX, label : "Luxury"}
Now you have your rest api /api/cars for which the get http request returns all cars
Suppose you want a query that returns the list of possible car types and their labels (which could be internationalized.
What would the uri be for this ?
Would you create a /api/cartypes uri ? Then you will have tons of uri's for all the dropdowns in your application.
If you allow to return the cartypes under the cars ressource.. what would the uri be ?
Thank you.
https://stackoverflow.com/questions/66077300/rest-api-best-practice-list-possible-values-of-entity-attribute February 06, 2021 at 09:14PM
没有评论:
发表评论