WELCOME Abdennour : Software engineer

May 17, 2012

5. REST: Understanding the architectural style

 1.What is REST?
2. Resources
3. Representations
4.Advantages & Disadvantages : REST:
6. Tools & Plateforms: 

 1.What is REST?

REST is an architectural style which is based on web-standards and the HTTP protocol.
REST was first described by Roy Fielding in 2000.

Be Careful: REST is not a format Neither a protocol Neither standard .

Difference between REST & RESTfull:

-REST is the Web Service.
            it is also called: DOA (DATA.OA) aet ROA (Ressources.OA)
-RESTfull: is the application that respects the architecture ROA.

What's REST?

       1.is Stateless
       2.Minimise system resources, but no session state.
-Resources  are uniquely identified by URIs.

REST request:
   1) Resources: -identified by URI.
               Exple: http://localhost:8080/insatdb/books
   2) Methods: Methods To manipulate the identifier:

       The HTTP standards methods which are typical used in REST are PUT, GET, POST, DELETE.
  • GET defines a reading access of the resource without side-effects. The resource is never changed via a GET request, e.g. the request has no side effects (idempotent).
  • PUT creates a new resource, must also be idempotent.
  • DELETE removes the resources. The operations are idempotent, they can get repeated without leading to different results.
  • POST updates an existing resource or creates a new resource.                                                        

   3) Representation of data transferred between server & client:
         => Example: XML, JSON, CSV, HTML ......

-The client is responsible for the state of resource.

2. Resources

-A resource can have multiple URIs.
      Example: Resource as: Books, Person
      Example: URI: http://localhost:8080/insatdb/books

-A resource may undergo(subir) four basic operations designated by CRUD (Create, Retrieve, Update, Delete)
 =>Create by the POST method
=> Retrieve by GET
=>Update = PUT-method
 =>Delete the DELETE method

3. Representations

Example Json format: Example XML format:

GET https://www.googleapis.com/urlshortener/v1/url?shortUrl=http://goo.gl/fbsS GET http://localhost:8080/librarycontentrestwebservice/contentbooks/string

"kind": "urlshortener#url",
"id": "http://goo.gl/fbsS",
"longUrl": "http://www.google.com/",
"status": "OK"

<?xml version="1.0"?>


Ce livre est une introduction sur la vie


NOTE: -Poster plugin available for Firefox for HTTP request issuing

Clear Difference: SOAP vs REST, 
             SOAPit sends an envelope,
              Rest is sent in an URI

4.Advantages & Disadvantages : REST:

# Interoperability
# Security (WS-Security)

 Ease of implementation
# Readability by humans
# Scalability
# Relies on the principles of the Web
# Multiple Views

Performance (SOAP envelope additional)
# Complexity, heaviness

Security restricted by the use of HTTP methods
- call resource only

Extended Web services (SOAP)
WDAL:Web Application Description Language)
=> is an XML description language for RESTful services.
=> Describe Service For elements of type:
      Resource, method, parameter, Request, Response
=> Example: http://localhost:8088/librarycontentrestwebservice/application.wadl

<?xml version="1.0"?>

<doc jersey:generatedBy="Jersey: 1.4 09/11/2010 10:30 PM" />

<resources base="http://localhost:8088/librarycontentrestwebservice/" >

<resource path="/contentbooks" >

<resource path="uribuilder2" >

  <method id="createURIBooks" name="POST" >
                 <representation mediaType="application/xml" />


                 <representation mediaType="*/*" />

<resource path="uribuilder1" >

    <method id="createBooksFromURI" name="POST" >
            <representation mediaType="application/xml" />

           <representation mediaType="*/*" />


6. Tools & Plateforms: 
Tools Plateforms

Reference : 

No comments:

Post a Comment