1. RESTFul API – Introduction
WHAT IS REST?
REST(REpresentational State Transfer) is a simple way to organize interactions between
independent systems.
A RESTful web service (also called a RESTful web API) is a web service implemented using
HTTP and the principles of REST. It is a collection of resources, with four defined aspects:
The base URI for the web service, such as http://example.com/resources/
The Internet media type of the data supported by the web service. This is often XML but can be any
other valid Internet media type provided that it is a valid hypertext standard like JSON.
The set of operations supported by the web service using HTTP methods (e.g., GET, PUT, POST,
DELETE).
The API must be hypertext driven.
2.
REST is not a standard, its a design pattern, you can't bottle REST vs SOAP: simplicity
up a pattern, you can only understand it and design your Web wins again
services to it.
All the major webservices on the Internet now use REST. REST is
used by Giant enterprises like Ebay, Amazon, Twitter, Yahoo. It's
also used by other popular products like Flickr, del.icio.us,
pubsub, bloglines, technorati.
REST is similar to SOAP but with following differences:
SOAP uses WSDL for communication btw consumer and
provider, whereas REST just uses XML or JSON to send and
receive data.
SOAP doesn't return human readable result, while REST result
is readable which is just plain XML or JSON.
3. Restful API Example: Updating Information using HTTP POST
Retrieving Information using HTTP GET Book: DaVince Code
Credit Card: Visa
Number: 123-45-6789 POST / /HTTP/1.1
Expiry: 12-04-06 POST HTTP/1.1
Host: http://www.amazon.com
GET //HTTP/1.1
GET HTTP/1.1 Host: http://www.amazon.com
http://www.amaz
on.com Host: http://www.amazon.com
Host: http://www.amazon.com Amazon
Web Server
Amazon Book: Da Vince Code
Book: Da Vince Code
Web Server Credit Card: Visa
Credit Card: Visa
Number: 123-45-6789
Number: 123-45-6789
Expiry: 12-04-06
Expiry: 12-04-06
User send a request to http://www.amazon.com
The browser software creates an HTTP header
The user fills in the Web page's form
The HTTP header identifies:
The browser software creates an HTTP header
with form data
The desired action: GET ("get me resource")
The HTTP header identifies:
The target machine (www.amazon.com) The desired action: POST
The target machine (amazon API call)
The payload contains: the form data
5. RESTful API – Key Highlights
Rich web client can talk directly with Application.
Useful when you have integrate multiple different clients
RESTful way takes less effort.
Works Out of the Box no setup,just a design model.
Standard API - Creating an API on standards that already exist makes it much easier for application
developers to use your API.
6. Who is using REST?
Google
GData,OpenSocial
Standards
Atom,WebDAV
Amazon
S3,SimpleDB
Buddy.com
7. Who is using REST?
Google
GData,OpenSocial
Standards
Atom,WebDAV
Amazon
S3,SimpleDB
Buddy.com