I've been trying to understand how RESTful web services work and I've come up with a series of doubts and questions for which I have been unable to find an answer. First of all and to make sure I am correctly understanding what this is all about, the following diagram summarizes what a RESTful architecture for a small website could look like:
The first server basically contains a set of services identified by URL's. Those services obtain information from different databases and provide it to someone asking through a REST API (JSON) over http or https. On another server, a web application in an MVC style interacts with those services through their URL's upon user requests.
- Is my understanding correct?
- How do web applications such as facebook cope with the delays in getting responses when handling multiple services?
- How does one make sure that only certain entities are allowed access to services (in this example, how does Server 1 authenticate Server 2)?
- Is it common to use these kinds of architectures for mobile applications too?
- When mixing this type of architecture with AJAX, are the AJAX calls done directly to the services or do they go through the main web application controller?