how would you guys structure your REST endpoints w...
# ktor
b
how would you guys structure your REST endpoints with ktor and locationsAPI when the same object can be retrieved by different keys? so i have as an example /api/articles/{id} (id is an UUID) but the same article can be fetched by it's unique name. would you prefer something like /api/articles/by-name/{name} or /api/articles/{name}/by-name or some kind of "polymorphism" where there is a manual check if the parameter is a UUID or a name?
i know this is not really related to ktor, but i thought i ask anyway 🙂
d
Why is your api designed to have to unique identifier? (UUID and Name)
☝️ 1
b
that's a weird question .. business requires it. it's basically unique synonyms and that's the way the data is.
v
If those were the only options I would preffer
/api/articles/by-name/{name}
, else
/api/articles?name={name}
b
i am open for better options 🙂
but i agree .. /api/articles/by-name/{name} is better than /api/articles/{name}/by-name