Lets say, I have a scenario where I have to expose an api to fetch supported shirt sizes(small
, medium
and large
)
My initial thought was /v1/shirts/sizes
- But this clashes with the existing fetch shirt by id api. v1/shirts/:id
.
My friend is suggesting, we can have resource named metadata, which can be used to list all static information throughout our application. Something like
/v1/metadata/shirtsizes
, /v1/metadata/languages
etc.
But I am not happy with having metadata
api since it have completely unrelated sub-resources(shirtsizes , supported-lanugages)
How to handle this scenario? Is there any way to achieve it?
:id
placeholder? E.g. if the ID is numeric, thensizes
won't conflict. Alternatively just add an endpoint like/v1/shirt-sizes
. Not as elegant, still better than introducing a metadata concept without strong justification.-