One web application using multiple RESTful APIs?
===

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:

 1. Is this common?
 1. Is this bad practice or bad architecture? If so,
    what are some alternatives?
 1. (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
 1. (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:

![enter image description here][1]

Diagram #2:

![enter image description here][2]


  [1]: http://i.stack.imgur.com/GVQmA.png
  [2]: http://i.stack.imgur.com/vl5i7.png