Best wrapper for simultaneous API requests?

473 Views Asked by At

I am looking for the easiest, simplest way to access web APIs that return either JSON or XML, with concurrent requests.

For example, I would like to call the twitter search API and return 5 pages of results at the same time (5 requests). The results should ideally be integrated and returned in one array of hashes.

I have about 15 APIs that I will be using, and already have code to access them individually (using simple a NET HTTP request) and parse them, but I need to make these requests concurrent in the easiest way possible. Additionally, any error handling for JSON/XML parsing is a bonus.

1

There are 1 best solutions below

0
On

I'd recommend Weary.

It handles multiple simultaneous asynchronous requests by spawning a thread for each request, and with it you can write API connectors that are readable and DRY. On top of that it has a built in .parse method which works with JSON or XML responses.