SlideShare a Scribd company logo
1 of 32
‫ُ ةِّ سِ ّتْ ّ‬
  ‫قور ة رست‬
  ‫‪Power of REST‬‬
‫إعداد: م/ تامر محمد عبد الراضي‬
‫مقدمة عن‬
‫‪HTTP‬‬
HTTP
●
    Hyper-Text Transfer Protocol
●
    Client-Server networking protocol
●
    Text based → Interoperability
●
    URL Examples:
     ●
         www.example.com/pages/first.htm
     ●
         www.blog.com/posts/hello-world
HTTP Methods
 ●
   HEAD
 ●
   GET
 ●
   POST
 ●
   PUT
 ●
   DELETE
 ●
   TRACE
 ●
   OPTIONS
 ●
   CONNECT
 ●
   PATCH
GET
●
    used retrieve information
●
    Doesn't have a side effect on the server
    side = No writes
●
    Cacheable
POST
●
    Add new information
●
    Append entry in a collection/table
PUT
●
    Update existing information
●
    Create new information with a known id
DELETE
●
    Remove an entity
HTTP Status Codes
 ●
   200   OK
 ●
   201   Created
 ●
   400   Bad Request
 ●
   401   Unauthorized
 ●
   404   Not Found
 ●
   500   Internal Server Error
‫يعني ايه رست ؟‬
 Representational State Transfer
A client has a state ( set of variables' values)
The client initiates a request to a resource URI
The server response with a representation of the resource.
The representation places the client application in a new state.

Thus, the client application changes (transfers) state with each
resource representation → Representational State Transfer!
REST
●   Software Architecture Style
●   Introduced by Roy Fielding
●   Based on HTTP
Characteristics of REST
●
    Stateless
        ●
            Each request from any client contains all of the information
            necessary to understand the request
    ●
        uniform interface
        ●
            GET, POST, PUT, and DELETE
    ●
        URIs
        ●
            resources that are uniquely identified by URIs
        ●
            → http://example.com/orders/101230/customer
REST Request consists of ...
 ●
     Resources
     ●
         nouns
     ●
         Identified by a URI
 ●
     Methods
     ●
         verbs
     ●
         GET, POST, PUT, and DELETE
 ●
     Sate Representation
     ●
         Session, parameters
Example: Blog System
Let's Design our Blog's API!
Functions of Our Blog

    ●
      Login
    ●
      Logout
    ●
      Write a Post
    ●
      Delete a Post
    ●
      Edit a Post
    ●
      Read a Post
    ●
      Comment on a Post
    ●
      Delete Comment
    ●
      Edit a comment
    ●
      Like a post
    ●
      Like a comment
Analyze, extract entities
●   Login = Create a session           ●
                                           Entities (Nouns)
    Logout = Delete the session
                                               Session
●
                                           ●

●   Write a Post                           ●
                                               Post
●   Delete a Post
                                               –   Likes
●   Edit a Post                                –   Comment
●   Read a Post                                     ●
                                                        Likes
●   Comment on a Post
●   Delete Comment
●   Edit a comment
●   Like a post = Add a like to post
●    Like a comment = Add a like to
    comment
Login
●   URI: http://api.blog.com/session
●   Method: POST
●   Parameters: user-name, password
●   Return
    ●   201 – Created
    ●   400 – Bad request
Logout
●   URI: http://api.blog.com/session
●   Method: DELETE
●   Parameters: N/A
●   Return
    ●   200 – OK
Write a Post
●   URI: http://api.blog.com/posts
●   Method: POST
●   Parameters: title, body
●   Return
    ●   201 – Created
    ●   400 – Bad request
Write/Edit a Post
●   URI: http://api.blog.com/posts/hello-world
●   Method: PUT
●   Parameters: title, body
●   Return
    ●   201 – Created
    ●   400 – Bad request
Delete a Post
●   URI: http://api.blog.com/posts/hello-world
●   Method: DELETE
●   Parameters: N/A
●   Return
    ●   200 – OK
    ●   401 – Not authorized
Read a Post
●   URI: http://api.blog.com/posts/hello-world
●   Method: GET
●   Parameters: N/A
●   Return
    ●   200 – OK
    ●   404 – Not found
Comment on post
●   URI: http://api.blog.com/posts/hello-
    world/comments
●   Method: POST
●   Parameters: comment
●   Return
    ●   201 – Created
    ●   400 – Bad request
Edit a Comment
●   URI: http://api.blog.com/posts/hello-
    world/comments/123
●   Method: PUT
●   Parameters: comment
●   Return
    ●   201 – Created
    ●   400 – Bad request
Delete a comment
●   URI: http://api.blog.com/posts/hello-
    world/comments/123
●   Method: DELETE
●   Parameters: N/A
●   Return
    ●   200 – OK
    ●   401 – Not authorized
Like a post
●   URI: http://api.blog.com/posts/hello-
    world/likes
●   Method: POST
●   Parameters: N/A
●   Return
    ●   201 – Created
Like a comment
●   URI: http://api.blog.com/posts/hello-
    world/comments/123/likes
●   Method: POST
●   Parameters: N/A
●   Return
    ●   201 – Created
Data representation
●       REST supports variety of formats
        ●   XML
        ●   JSON
        ●   X(HTML)
REST supports content negotiation
●


    ●   Header-based:
        GET /foo
        Accept: application/json
    ●   URL-Based
        http://api.blog.com/posts/hello-world.json
JSON
●
    JavaScript Object Notation
●
    representing simple data structures and
    associative arrays, called objects.
{
    'Post' : {
      'title' : 'hello-world',
      'body': 'bla bla bla …',
      'comments' : {
            'Comment' : [
                {'name':'Folaan', 'comment':'Hi'},
                {'name':'3ellan', 'comment':'Hello'}
              ]
        },
        'likes': ['Follan', '3ellan']
    }
}
?
Questions

More Related Content

Viewers also liked

Value proposition creation by Barbara Bix, BB Marketing Plus
Value proposition creation by Barbara Bix, BB Marketing PlusValue proposition creation by Barbara Bix, BB Marketing Plus
Value proposition creation by Barbara Bix, BB Marketing Plusbbmarketingplus
 
Roupas Doadas
Roupas DoadasRoupas Doadas
Roupas Doadasicemp-ong
 
Super Mercado Continental (Vila Hortência)
Super Mercado Continental (Vila Hortência)Super Mercado Continental (Vila Hortência)
Super Mercado Continental (Vila Hortência)icemp-ong
 
Tus manos pueden salvar vidas: presentación de un alumno de 4º de primaria
Tus manos pueden salvar vidas: presentación de un alumno de 4º de primariaTus manos pueden salvar vidas: presentación de un alumno de 4º de primaria
Tus manos pueden salvar vidas: presentación de un alumno de 4º de primariaMarta Nonide Robles
 
Matriz BCG clássico - Ferramenta de gestão
Matriz BCG clássico - Ferramenta de gestãoMatriz BCG clássico - Ferramenta de gestão
Matriz BCG clássico - Ferramenta de gestãoOdair Junior Bergamo
 
Teoría política contractual
Teoría política contractualTeoría política contractual
Teoría política contractualGeopress
 
Cirkulär ekonomi i hållbart betongbyggande - Otto During, CBI Betonginstitutet.
Cirkulär ekonomi i hållbart betongbyggande - Otto During, CBI Betonginstitutet.Cirkulär ekonomi i hållbart betongbyggande - Otto During, CBI Betonginstitutet.
Cirkulär ekonomi i hållbart betongbyggande - Otto During, CBI Betonginstitutet.Svenska Betongföreningen
 
Syror och baser sammanfattning
Syror och baser   sammanfattningSyror och baser   sammanfattning
Syror och baser sammanfattningMalin Åhrby
 
Cloud computing presentation
Cloud computing presentationCloud computing presentation
Cloud computing presentationMonsif sakienah
 

Viewers also liked (12)

Value proposition creation by Barbara Bix, BB Marketing Plus
Value proposition creation by Barbara Bix, BB Marketing PlusValue proposition creation by Barbara Bix, BB Marketing Plus
Value proposition creation by Barbara Bix, BB Marketing Plus
 
Roupas Doadas
Roupas DoadasRoupas Doadas
Roupas Doadas
 
Super Mercado Continental (Vila Hortência)
Super Mercado Continental (Vila Hortência)Super Mercado Continental (Vila Hortência)
Super Mercado Continental (Vila Hortência)
 
Ara paja 070616 jyrkkälän allianssihanke
Ara paja 070616 jyrkkälän allianssihankeAra paja 070616 jyrkkälän allianssihanke
Ara paja 070616 jyrkkälän allianssihanke
 
271016 rakentamisen ohjaus ja kohtuuhintaisen asumisen mallihankkeet vesa ijäs
271016 rakentamisen ohjaus ja kohtuuhintaisen asumisen mallihankkeet vesa ijäs271016 rakentamisen ohjaus ja kohtuuhintaisen asumisen mallihankkeet vesa ijäs
271016 rakentamisen ohjaus ja kohtuuhintaisen asumisen mallihankkeet vesa ijäs
 
Tus manos pueden salvar vidas: presentación de un alumno de 4º de primaria
Tus manos pueden salvar vidas: presentación de un alumno de 4º de primariaTus manos pueden salvar vidas: presentación de un alumno de 4º de primaria
Tus manos pueden salvar vidas: presentación de un alumno de 4º de primaria
 
Matriz BCG clássico - Ferramenta de gestão
Matriz BCG clássico - Ferramenta de gestãoMatriz BCG clássico - Ferramenta de gestão
Matriz BCG clássico - Ferramenta de gestão
 
Teoría política contractual
Teoría política contractualTeoría política contractual
Teoría política contractual
 
Energiatehokkuussopimukset 2017-2025
Energiatehokkuussopimukset 2017-2025Energiatehokkuussopimukset 2017-2025
Energiatehokkuussopimukset 2017-2025
 
Cirkulär ekonomi i hållbart betongbyggande - Otto During, CBI Betonginstitutet.
Cirkulär ekonomi i hållbart betongbyggande - Otto During, CBI Betonginstitutet.Cirkulär ekonomi i hållbart betongbyggande - Otto During, CBI Betonginstitutet.
Cirkulär ekonomi i hållbart betongbyggande - Otto During, CBI Betonginstitutet.
 
Syror och baser sammanfattning
Syror och baser   sammanfattningSyror och baser   sammanfattning
Syror och baser sammanfattning
 
Cloud computing presentation
Cloud computing presentationCloud computing presentation
Cloud computing presentation
 

Similar to Power of REST - قوة الرست

NEPHP '13: Pragmatic API Development
NEPHP '13: Pragmatic API DevelopmentNEPHP '13: Pragmatic API Development
NEPHP '13: Pragmatic API DevelopmentAndrew Curioso
 
Django REST Framework 2022fffffffff.pptx
Django REST Framework 2022fffffffff.pptxDjango REST Framework 2022fffffffff.pptx
Django REST Framework 2022fffffffff.pptxThirzaAhmadTsaqif
 
Restful api design
Restful api designRestful api design
Restful api designMizan Riqzia
 
What You Need to Know About Technical SEO
What You Need to Know About Technical SEOWhat You Need to Know About Technical SEO
What You Need to Know About Technical SEONiki Mosier
 
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...CA API Management
 
Microservices in Scala: Spray
Microservices in Scala: SprayMicroservices in Scala: Spray
Microservices in Scala: SprayŁukasz Sowa
 
One Person's Perspective on a Pragmatic REST Interface
One Person's Perspective on a Pragmatic REST InterfaceOne Person's Perspective on a Pragmatic REST Interface
One Person's Perspective on a Pragmatic REST Interfaceabrummett
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Caldera Labs
 
Angular auth with JWT
Angular auth with JWTAngular auth with JWT
Angular auth with JWTMVP Microsoft
 
Understanding APIs.pptx introduction chk
Understanding APIs.pptx introduction chkUnderstanding APIs.pptx introduction chk
Understanding APIs.pptx introduction chknooreen nayyar syeda
 
Beginning WordPress Workshop
Beginning WordPress WorkshopBeginning WordPress Workshop
Beginning WordPress WorkshopThe Toolbox, Inc.
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座Li Yi
 

Similar to Power of REST - قوة الرست (20)

Rest api-basic
Rest api-basicRest api-basic
Rest api-basic
 
NEPHP '13: Pragmatic API Development
NEPHP '13: Pragmatic API DevelopmentNEPHP '13: Pragmatic API Development
NEPHP '13: Pragmatic API Development
 
02-http.pptx
02-http.pptx02-http.pptx
02-http.pptx
 
Django REST Framework 2022fffffffff.pptx
Django REST Framework 2022fffffffff.pptxDjango REST Framework 2022fffffffff.pptx
Django REST Framework 2022fffffffff.pptx
 
Play! with rest
Play! with restPlay! with rest
Play! with rest
 
Restful api design
Restful api designRestful api design
Restful api design
 
Attacking REST API
Attacking REST APIAttacking REST API
Attacking REST API
 
Joomla REST API
Joomla REST APIJoomla REST API
Joomla REST API
 
What You Need to Know About Technical SEO
What You Need to Know About Technical SEOWhat You Need to Know About Technical SEO
What You Need to Know About Technical SEO
 
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
API Design Methodology - Mike Amundsen, Director of API Architecture, API Aca...
 
Cqrs api
Cqrs apiCqrs api
Cqrs api
 
Microservices in Scala: Spray
Microservices in Scala: SprayMicroservices in Scala: Spray
Microservices in Scala: Spray
 
One Person's Perspective on a Pragmatic REST Interface
One Person's Perspective on a Pragmatic REST InterfaceOne Person's Perspective on a Pragmatic REST Interface
One Person's Perspective on a Pragmatic REST Interface
 
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
Single Page Web Apps As WordPress Admin Interfaces Using AngularJS & The Word...
 
Angular auth with JWT
Angular auth with JWTAngular auth with JWT
Angular auth with JWT
 
Understanding APIs.pptx
Understanding APIs.pptxUnderstanding APIs.pptx
Understanding APIs.pptx
 
Understanding APIs.pptx introduction chk
Understanding APIs.pptx introduction chkUnderstanding APIs.pptx introduction chk
Understanding APIs.pptx introduction chk
 
Beginning WordPress Workshop
Beginning WordPress WorkshopBeginning WordPress Workshop
Beginning WordPress Workshop
 
I18n of java script
I18n of java scriptI18n of java script
I18n of java script
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座
 

More from noZom Information Technology NGO (8)

مقدمة عن لغة سكالا
مقدمة عن لغة سكالامقدمة عن لغة سكالا
مقدمة عن لغة سكالا
 
To infinity and beyond!
To infinity and beyond!To infinity and beyond!
To infinity and beyond!
 
Introduction to Scrum
Introduction to ScrumIntroduction to Scrum
Introduction to Scrum
 
انت و الويب
انت و الويبانت و الويب
انت و الويب
 
اي فون ام اندرويد
اي فون ام اندرويداي فون ام اندرويد
اي فون ام اندرويد
 
Why Entrepreneurship? لماذا ريادة الاعمال؟
Why Entrepreneurship? لماذا ريادة الاعمال؟Why Entrepreneurship? لماذا ريادة الاعمال؟
Why Entrepreneurship? لماذا ريادة الاعمال؟
 
nozom geeks - مهاويس نظم
nozom geeks - مهاويس نظمnozom geeks - مهاويس نظم
nozom geeks - مهاويس نظم
 
Learn2 learn - اتعلم تتعلم
Learn2 learn - اتعلم تتعلمLearn2 learn - اتعلم تتعلم
Learn2 learn - اتعلم تتعلم
 

Recently uploaded

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...apidays
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Zilliz
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxRemote DBA Services
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Orbitshub
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 

Recently uploaded (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 

Power of REST - قوة الرست

  • 1.
  • 2. ‫ُ ةِّ سِ ّتْ ّ‬ ‫قور ة رست‬ ‫‪Power of REST‬‬ ‫إعداد: م/ تامر محمد عبد الراضي‬
  • 4. HTTP ● Hyper-Text Transfer Protocol ● Client-Server networking protocol ● Text based → Interoperability ● URL Examples: ● www.example.com/pages/first.htm ● www.blog.com/posts/hello-world
  • 5. HTTP Methods ● HEAD ● GET ● POST ● PUT ● DELETE ● TRACE ● OPTIONS ● CONNECT ● PATCH
  • 6. GET ● used retrieve information ● Doesn't have a side effect on the server side = No writes ● Cacheable
  • 7. POST ● Add new information ● Append entry in a collection/table
  • 8. PUT ● Update existing information ● Create new information with a known id
  • 9. DELETE ● Remove an entity
  • 10. HTTP Status Codes ● 200 OK ● 201 Created ● 400 Bad Request ● 401 Unauthorized ● 404 Not Found ● 500 Internal Server Error
  • 11. ‫يعني ايه رست ؟‬ Representational State Transfer A client has a state ( set of variables' values) The client initiates a request to a resource URI The server response with a representation of the resource. The representation places the client application in a new state. Thus, the client application changes (transfers) state with each resource representation → Representational State Transfer!
  • 12. REST ● Software Architecture Style ● Introduced by Roy Fielding ● Based on HTTP
  • 13. Characteristics of REST ● Stateless ● Each request from any client contains all of the information necessary to understand the request ● uniform interface ● GET, POST, PUT, and DELETE ● URIs ● resources that are uniquely identified by URIs ● → http://example.com/orders/101230/customer
  • 14. REST Request consists of ... ● Resources ● nouns ● Identified by a URI ● Methods ● verbs ● GET, POST, PUT, and DELETE ● Sate Representation ● Session, parameters
  • 15. Example: Blog System Let's Design our Blog's API!
  • 16. Functions of Our Blog ● Login ● Logout ● Write a Post ● Delete a Post ● Edit a Post ● Read a Post ● Comment on a Post ● Delete Comment ● Edit a comment ● Like a post ● Like a comment
  • 17. Analyze, extract entities ● Login = Create a session ● Entities (Nouns) Logout = Delete the session Session ● ● ● Write a Post ● Post ● Delete a Post – Likes ● Edit a Post – Comment ● Read a Post ● Likes ● Comment on a Post ● Delete Comment ● Edit a comment ● Like a post = Add a like to post ● Like a comment = Add a like to comment
  • 18. Login ● URI: http://api.blog.com/session ● Method: POST ● Parameters: user-name, password ● Return ● 201 – Created ● 400 – Bad request
  • 19. Logout ● URI: http://api.blog.com/session ● Method: DELETE ● Parameters: N/A ● Return ● 200 – OK
  • 20. Write a Post ● URI: http://api.blog.com/posts ● Method: POST ● Parameters: title, body ● Return ● 201 – Created ● 400 – Bad request
  • 21. Write/Edit a Post ● URI: http://api.blog.com/posts/hello-world ● Method: PUT ● Parameters: title, body ● Return ● 201 – Created ● 400 – Bad request
  • 22. Delete a Post ● URI: http://api.blog.com/posts/hello-world ● Method: DELETE ● Parameters: N/A ● Return ● 200 – OK ● 401 – Not authorized
  • 23. Read a Post ● URI: http://api.blog.com/posts/hello-world ● Method: GET ● Parameters: N/A ● Return ● 200 – OK ● 404 – Not found
  • 24. Comment on post ● URI: http://api.blog.com/posts/hello- world/comments ● Method: POST ● Parameters: comment ● Return ● 201 – Created ● 400 – Bad request
  • 25. Edit a Comment ● URI: http://api.blog.com/posts/hello- world/comments/123 ● Method: PUT ● Parameters: comment ● Return ● 201 – Created ● 400 – Bad request
  • 26. Delete a comment ● URI: http://api.blog.com/posts/hello- world/comments/123 ● Method: DELETE ● Parameters: N/A ● Return ● 200 – OK ● 401 – Not authorized
  • 27. Like a post ● URI: http://api.blog.com/posts/hello- world/likes ● Method: POST ● Parameters: N/A ● Return ● 201 – Created
  • 28. Like a comment ● URI: http://api.blog.com/posts/hello- world/comments/123/likes ● Method: POST ● Parameters: N/A ● Return ● 201 – Created
  • 29. Data representation ● REST supports variety of formats ● XML ● JSON ● X(HTML) REST supports content negotiation ● ● Header-based: GET /foo Accept: application/json ● URL-Based http://api.blog.com/posts/hello-world.json
  • 30. JSON ● JavaScript Object Notation ● representing simple data structures and associative arrays, called objects.
  • 31. { 'Post' : { 'title' : 'hello-world', 'body': 'bla bla bla …', 'comments' : { 'Comment' : [ {'name':'Folaan', 'comment':'Hi'}, {'name':'3ellan', 'comment':'Hello'} ] }, 'likes': ['Follan', '3ellan'] } }