I have an API that manages projects. You can get a single project via this endpoint, where {id} is a numeric project ID:
/projects/{id}
Each project can have one or more tags. Now I want to add an endpoint that will return an array of all tags that are assigned to at least one project.
My inclination is to put this endpoint at:
/projects/tags
But I have a vague feeling that that may not be the best way to do it, because now the /projects/{id|"tags"}
route has two different meanings.
Would it be better to add a distinct /project_tags
endpoint instead? Are there pros/cons, or established practices in this regard?
But I have a vague feeling that that may not be the best way to do it, because now the /projects/{id|"tags"} route has two different meanings.
URIs are addressed to HTTP clients, who could not care less about meanings. If you are writing URIs for humans, then you have many more problems. More precisely one for every single human being allowed to read your API endpoints.