This document provides an overview of HTTP and REST APIs. It describes how HTTP allows sending documents over the web using URLs to identify resources and HTTP verbs like GET, PUT, DELETE and POST. It defines common response codes. It explains that REST stands for Representational State Transfer and relies on a stateless, client-server architecture using the HTTP protocol. The key design constraints of REST include having a uniform interface, being resource-based and using representations to manipulate resources with self-descriptive messages. Benefits include statelessness for scalability, cacheability to improve performance, separating clients from servers, and using a layered system with intermediary servers.
3. Developed by W3C - World Wide Web Consortium
Technical Architecture Group (TAG) in parallel with HTTP 1.1
Software architecture
Components
Connectors
Data
Architectural properties
4. Allows for sending documents back & forth on the web.
URL’s Identifies a “Resource”.
/Team - identify all Team
/Team/QA/ABC - identify the Member of a team.
HTTP Verbs
GET / PUT / DELETE / POST
Representations
Response Codes
200 OK
201 Created
500 Internal Server Error
400 Bad Request
404 Not Found
5. REST – API Stands for?
Request Static Transfer
Remote State Transfer
Remote Stored Transfer
Remote Static Transfer
Correct Answer is…
REpresentational State Transfer
6. Relies on a
Stateless
Client - Server
Cacheable communications protocol
HTTP protocol is used.
Architecture Style for designing networked applications
The Design Constraints for REST – API style.
7. Uniform Interface
Simplifies and Decouples the architecture.
Enables each part to evolve independently.
Four guiding principles
Resource-Based
Manipulation of Resources Through Representations
Self-descriptive Messages
Hypermedia as the Engine of Application State (HATEOAS)
8. Stateless
State to handle the request is contained within the request itself.
The URI uniquely identifies the resource and the body contains the state
(or state change) of that resource.
After Server Process - communicated back to the client via headers,
status and response body.
Enables greater scalability - server does not have to maintain, update or
communicate that session state.
Load balancers don't have to worry about session affinity for stateless
systems
9. Cacheable
Well-managed caching partially or completely eliminates some client–
server interactions, further improving scalability and performance.
Client-Server
Uniform interface separates clients from servers.
Clients are not concerned with data storage - portability of client code is
improved.
Servers are not concerned with the user interface or user state - servers
can be simpler and more scalable
10. Layered System
A client cannot connected directly to the end server.
A client may connected with Server via Intermediary servers.
Intermediary servers may improve system scalability by enabling load-
balancing.
Helps to enforce security policies.
11. Network Performance
Efficiency - Caching data
Scalability - Gateway, Proxy and layered
User Perceived Performance - Caching
pre-fetched information
- Eg: Form Validation