I just saw the beta was released and there was a nice new RESTful API! I read through the docs but wasn’t sure about this.
At my company we build a lot of mobile apps. Often when initializing the application data, and throughout the apps use, numerous RESTful requests need to be made to request different data from different tables and such.
Since every single API request takes a certain amount of overhead on the connection, o[size="2"]ne really important task that comes up when building an API driven app is the ability to combine numerous REST requests into a single one.[/size]
[size="2"]For example, if we need the hit a few endpoints, instead of requesting:[/size]
[size="2"]GET /api/users/[/size]
[size="2"]GET /api/posts/[/size]
[size="2"]POST /api/history[/size]
[size="2"]We would hit "[/size][size="2"]/api/multiplexor" with:[/size]
{
"requests": [
{
"url":"/api/users",
"type":"GET"
},
{
"url":"/api/posts",
"type":"GET"
},
{
"url":"/api/history",
"type":"POST",
"data":{"key":"value", "etc":"..." }
},
]
}
And receive the response with a similar array of results.
This cutting down of the requests into a single one can save a great deal of time over multiple requests.
Is there a way to use the RESTful API to do this?
If not, it seems like it would be really easy to implement if we can do internal requests to API endpoints.