-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Don't know how difficult this is, but creating an alias for certain endpoints could be a useful core feature. As example:
Lets say we have endpoints for pages or custom products-records. Instead of requesting /pages/123 or /products/987, it would be useful if e.g. the slug attribute of the records could be used as alias for ID.
Reason: currently, if a front-end wants to use SEO friendly URLs like /show/demo-item, it has to query for all products, loop through the result array, find the record matching demo-item, get the corresponding ID and request the API again to get the product details (the mapping happens on front-end side).
Maybe a TypeConverter can be used (see here and here) or the ID field can be selected with a condition:
IF {alias} is not empty THAN query by {alias} == {id}
ELSE query by uid == {id} (current implementation)
itemOperations={
"get"={
"method"="GET",
"path"="/pages/{id}",
"alias"="slug",
},
},
Not sure if a REST API should be made for such things in general, please see it only as suggestion, discussion welcomed :)