It's common to nest resources in a RESTful API. For example, to retrieve the employees in company having ID=5:
GET /companies/5/employees
Is it also generally acceptable in a REST design to put resources in a common "directory" where they don't really belong-to a common parent resource instance? This is more of a "is-a" relationship, where I think the typical nested structure has the nested resources in a "belongs-to" relationship.
For example, is it acceptable to group two different resources (internal agents, external agents) like follows? In this case the agents
part of the path is a category that describes its descendants but isn't really a parent resource.
GET /agents/internal
GET /agents/external
There are no plans to add any resources using the /agents
path; it is solely for grouping purposes.
Or is that to be avoided for something like this?
GET /internal-agents
GET /external-agents
I feel like the second option is more correct, but there is an aesthetic to the first option that that I like.