Eslam Hamouda
Software Developer , CS Student , Technology Addict , I love making simple things with great impact. i spend most of my time making apps or reading.
Framework
Technology
even a Standard Specification
for creating web services.
Separates user interface concerns from data storage concerns
HTTP
Each request from any client contains all the information necessary to service the request
Client: Hi, Server
Server: Who Are You ?
Client: I'm Eslam!
Server: OK! I Know you, Hi Eslam ;)
Client: What is my schedule today ?
Server: Who Are You ?
Client: I'm the one who just saied Hi, Server !
Server: Nope, we didn't met before!, Who Are You ?
Client: I'm Eslam! is that Okay for you?
Server: Hi Eslam, Sorry my memory is not plugged-in.
Client: I'm Eslam!, what is my schedule for today ?
Server: You have an AWESOME session at CAT Scope Event.
Client: Thank You Server!
Server: Who Are You ?
Game... ?
- Clients can cache responses.
- Responses must therefore, implicitly or explicitly, define themselves as cacheable, or not.
A client cannot ordinarily tell whether it is connected directly to the end server, or to an intermediary along the way. Intermediary servers may improve system scalability by enabling load balancing and by providing shared caches.
Servers can temporarily extend or customize the functionality of a client by the transfer of executable code. Examples of this may include compiled components such as Java applets and client-side scripts such as JavaScript.
* this is the only optional constraint of the REST architecture.
-- Linus Torvalds
Base URL : https://api.github.com
Entities: Users, Repos,Gists ...
Create, Read, Update, Delete (CRUD)
POST, GET, PUT, DELETE
Map Operations to HTTP Verbs :-
- How to list all Users ?
POST /getAllUsers HTTP/1.1
Accept: */*
Host: api.github.com
URLs should contain (Plural) Nouns
Embrace HTTP Verbs
GET /users HTTP/1.1
Accept: */*
Host: api.github.com
- How to display user 'eslamx7' basic information?
GET /users?username=eslamx7 HTTP/1.1
Accept: */*
Host: api.github.com
Keep URL Simple !!!
Avoid using Query Strings as Entity Attributes
GET /users/eslamx7 HTTP/1.1
Accept: */*
Host: api.github.com
Much better,simple and more readable
- How to list public repos of user 'eslamx7' ?
GET /users/eslamx7/repos HTTP/1.1
Accept: */*
Host: api.github.com
GET graph.facebook.com/v2.3/me HTTP/1.1
URL
GET eslamx.com/api/me HTTP/1.1
X-API-Version: 1.2
Custom request header
GET api.github.com/users/eslamx7 HTTP/1.1
Accept: application/vnd.github.com.v2+json
Accept header
GET api.eslamx.com/me?v=2 HTTP/1.1
Query String
Formats (JSON, XML)
Error Handling
HTTP Status Codes
Error Messages
Pagination
Offset / Limit
HATEOAS
Rate Limit
Tools...?
Follow me : @EslaMx7
By Eslam Hamouda
introduction to REST-based web API, how to design a mobile-friendly web API, how to secure an API.
Software Developer , CS Student , Technology Addict , I love making simple things with great impact. i spend most of my time making apps or reading.