I am architecting a web application which will need to communicate with multiple (two or three) existing RESTful APIs. Each API provides different data and functionality. The web application will essentially glue the APIs together into one user interface.
Based on this scenario, I have a few questions:
- Is this common?
- Is this bad practice or bad architecture? If so, what are some alternatives?
- (diagram #1 below) I’d like to use JavaScript + AJAX to interact with these APIs. Would I make AJAX requests to the different domains, addressing them with different, absolute URLs? e.g., http://api1.domain.com/something, http://api.domain.com/something_else
- (diagram #2 below) Instead of (3), should I simply have my backend controllers interact with these APIs, and then have my frontend (JavaScript) interact with my application’s controllers? Essentially this would be a facade.
I am delving into SOA, so forgive me if I sound ignorant. And FWIW, I’m planning to use Ruby on Rails.
Diagram #1:

Diagram #2:
