We have a not so RESTful API used by our single page app and mobile apps.
It is not so RESTfu since in the past, URI's have returned whatever was useful for a particular page. This has led to a large number of endpoints, with many having very similar responses.
Datawise we have resources with tens of related resources. In some cases we want those related resources returned, or some of them, and other cases we do not. Some are slow to return, and therefore we only want them in specific cases.
The problem we've had has been with splitting the data up into meaningful URI's, without needing another request to get each related resource.
we therefore considered a /batch endpoint where a POST request containing a number of requests in the body could execute those requests in parallel on the server. Like this https://developers.facebook.com/docs/graph-api/making-multiple-requests
That way we could split the data into meaningful URI's and not have to make 20 API requests for each page.
Is this an acceptable way of handling related resources? Or would it be better to have a URI for each response that we may want?