Let's say I have the following entities that can be accessed at the following URIs (using the standard pluralization):
/things/:id
and /otherthings/:id
I want to expose for performance reasons, an api that will response with the following structure:
{
"things": [],
"otherthings": []
}
The call is so that my clients can retrieve all entities in a single call, instead of making two separate calls to /things
and /otherthings
.
My question
Would it make sense to wrap this in a call to /thingscontainer
or something and consider it a new entity? I only want to expose a GET for the call to get the "container" with both collections, and all further interactions with the entities or entity collections themselves will hit their own appropriate "things" endpoints.
The "container" object approach I'm outlining seems like it might not be very RESTful. I'm fine with that but would like any ideas on ways to avoid deviating from it if possible.