SlideShare a Scribd company logo
1 of 15
ReST (Introduction)


 3rd Meetup PHP Indonesia

         6 April 2013
          Surabaya



       by Glend Maatita
ReST example (Twitter)
ReST example (Facebook)
ReST - History

●   Representational State Transfer


●   ReST was re-DISCOVER-ed by Roy Fielding


●   Doesnt require any external library


●   Tightly bond with HTTP
ReST – HTTP
Client Send Request           Server Send Response




GET / HTTP/1.1
Host: xkcd.com            HTTP/1.1 200 OK
Accept: text/html         Date: Sat, 02 Apr 2011 21:05:05 GMT
User-Agent: Mozilla/5.0   Server: lighttpd/1.4.19
(Macintosh)
                          Content-Type: text/html
                          <html>...</html>
ReST - HTTP
    HTTP Verb
●   GET
●   POST
●   PUT
●   DELETE


    Routes
●   URL + HTTP Verb
ReST - Definition


“The Same Thing with a different STATE
changes its meaning”


“The message is changed based on it's
State”
ReST – How To
●   Loved by developer
●   Easy to read, easy to
    understand, easy to learn
ReST
Bad !!                      Imagine :)


/getAllUsers                /getMentions
/getUserById                /getUserTimeLine
/getUsers                   /getHomeTimeLine
/deleteUser                 /getStatusesRetweet
/updateUser                 /updateStatuses
/deleteUserTenYearsOld      /destroyStatus
/newUser                    /getRetweets
/getUserUnderTenYearsOld
ReST - Quotes


“Web it's not about HTML pages, it's about resources,
    and those resources are located by URLs”
So ?
● We only need two base URLs as the location of a resource
(collection of resource, and single resource)
● Resources is Noun, use Noun :)

● Plural is better




    Resource    POST          GET (READ)       PUT            DELETE
                (CREATE)                       (UPDATE)


    /users      Create new    List all Users   Update All     Delete All
                user                           Users          Users


    /users/1    -             Show User        Update User Delete User
                              (with ID = 1)    with ID = 1 (if with ID = 1
                                               Exist)
Association ?
Easy :)


GET /departments/1/users
POST /departments/1/users
PUT /users/123
DELETE /users/123
Query
Use '?' for Query


GET /users?limit=50&offset=100
GET /users?username=indra&birth=1990
GET /users?column=id,name,username,birth
GET /users.json (/users.xml)
Versioning
/v1/users/
Terima Kasih




                Glend Maatita
                  @glend_maatita
                  YM : the_entung
      glend.maatita@kampus.co.id

More Related Content

Viewers also liked

NEW WORLD COMING
NEW WORLD COMINGNEW WORLD COMING
NEW WORLD COMING
jpscheller
 

Viewers also liked (20)

How To Make Your Day Last Longer: Time Management in Marketing Projects
How To Make Your Day Last Longer: Time Management in Marketing Projects How To Make Your Day Last Longer: Time Management in Marketing Projects
How To Make Your Day Last Longer: Time Management in Marketing Projects
 
Pharmacognosy 5th sem
Pharmacognosy 5th semPharmacognosy 5th sem
Pharmacognosy 5th sem
 
Understanding the state of your web application using Apache Kafka, Spark
Understanding the state of your web application using Apache Kafka, SparkUnderstanding the state of your web application using Apache Kafka, Spark
Understanding the state of your web application using Apache Kafka, Spark
 
NEW WORLD COMING
NEW WORLD COMINGNEW WORLD COMING
NEW WORLD COMING
 
Paycreditreport
PaycreditreportPaycreditreport
Paycreditreport
 
iprocurment Buyer Guide
iprocurment Buyer Guideiprocurment Buyer Guide
iprocurment Buyer Guide
 
Generation 3
Generation 3Generation 3
Generation 3
 
Kidnapped nt
Kidnapped ntKidnapped nt
Kidnapped nt
 
Navegadores web
Navegadores webNavegadores web
Navegadores web
 
Philippine Java Industry
Philippine Java IndustryPhilippine Java Industry
Philippine Java Industry
 
Immigration
ImmigrationImmigration
Immigration
 
Pharmacognosy 5th sem
Pharmacognosy 5th semPharmacognosy 5th sem
Pharmacognosy 5th sem
 
Exploring membership 3
Exploring membership 3Exploring membership 3
Exploring membership 3
 
Rails 3
Rails 3Rails 3
Rails 3
 
2010 NYC Presentation
2010 NYC Presentation2010 NYC Presentation
2010 NYC Presentation
 
N efemed gs1 standaard kosten of kansen
N efemed gs1 standaard kosten of kansenN efemed gs1 standaard kosten of kansen
N efemed gs1 standaard kosten of kansen
 
Node.js Presentation
Node.js PresentationNode.js Presentation
Node.js Presentation
 
How to survive and thrive in the era of free shipping
How to survive and thrive in the era of free shippingHow to survive and thrive in the era of free shipping
How to survive and thrive in the era of free shipping
 
2011 (5) mar
2011 (5) mar2011 (5) mar
2011 (5) mar
 
СЕТЕВЫЕ ПРОЕКТЫ КАК СРЕДСТВА ФОРМИРОВАНИЯ ИНФОРМАЦИОННОЙ КОМПЕТЕНТНОСТИ ОБУЧА...
СЕТЕВЫЕ ПРОЕКТЫ КАК СРЕДСТВА ФОРМИРОВАНИЯ ИНФОРМАЦИОННОЙ КОМПЕТЕНТНОСТИ ОБУЧА...СЕТЕВЫЕ ПРОЕКТЫ КАК СРЕДСТВА ФОРМИРОВАНИЯ ИНФОРМАЦИОННОЙ КОМПЕТЕНТНОСТИ ОБУЧА...
СЕТЕВЫЕ ПРОЕКТЫ КАК СРЕДСТВА ФОРМИРОВАНИЯ ИНФОРМАЦИОННОЙ КОМПЕТЕНТНОСТИ ОБУЧА...
 

Similar to PHP Indonesia 3rd meetup - 06/04/13

RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座
Li Yi
 
04 request-headers
04 request-headers04 request-headers
04 request-headers
snopteck
 
nguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-servicenguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-service
hazzaz
 

Similar to PHP Indonesia 3rd meetup - 06/04/13 (20)

REST API Laravel
REST API LaravelREST API Laravel
REST API Laravel
 
Rest And Rails
Rest And RailsRest And Rails
Rest And Rails
 
L18 REST API Design
L18 REST API DesignL18 REST API Design
L18 REST API Design
 
RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座RESTful SOA - 中科院暑期讲座
RESTful SOA - 中科院暑期讲座
 
Day02 a pi.
Day02   a pi.Day02   a pi.
Day02 a pi.
 
REST & RESTful Web Service
REST & RESTful Web ServiceREST & RESTful Web Service
REST & RESTful Web Service
 
Restful webservices
Restful webservicesRestful webservices
Restful webservices
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 
RESTful Web Services
RESTful Web ServicesRESTful Web Services
RESTful Web Services
 
rest-api-basics.pptx
rest-api-basics.pptxrest-api-basics.pptx
rest-api-basics.pptx
 
ROA.ppt
ROA.pptROA.ppt
ROA.ppt
 
Getting started with DSpace 7 REST API
Getting started with DSpace 7 REST APIGetting started with DSpace 7 REST API
Getting started with DSpace 7 REST API
 
Data persistence using pouchdb and couchdb
Data persistence using pouchdb and couchdbData persistence using pouchdb and couchdb
Data persistence using pouchdb and couchdb
 
Resource-Oriented Web Services
Resource-Oriented Web ServicesResource-Oriented Web Services
Resource-Oriented Web Services
 
04 request-headers
04 request-headers04 request-headers
04 request-headers
 
RESTful web service with JBoss Fuse
RESTful web service with JBoss FuseRESTful web service with JBoss Fuse
RESTful web service with JBoss Fuse
 
RESTful for opentravel.org by HP
RESTful for opentravel.org by HPRESTful for opentravel.org by HP
RESTful for opentravel.org by HP
 
Learn REST in 18 Slides
Learn REST in 18 SlidesLearn REST in 18 Slides
Learn REST in 18 Slides
 
nguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-servicenguyenhainhathuy-building-restful-web-service
nguyenhainhathuy-building-restful-web-service
 
Understanding REST
Understanding RESTUnderstanding REST
Understanding REST
 

Recently uploaded

+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...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
+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...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
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, ...
 
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
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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...
 

PHP Indonesia 3rd meetup - 06/04/13

  • 1. ReST (Introduction) 3rd Meetup PHP Indonesia 6 April 2013 Surabaya by Glend Maatita
  • 4. ReST - History ● Representational State Transfer ● ReST was re-DISCOVER-ed by Roy Fielding ● Doesnt require any external library ● Tightly bond with HTTP
  • 5. ReST – HTTP Client Send Request Server Send Response GET / HTTP/1.1 Host: xkcd.com HTTP/1.1 200 OK Accept: text/html Date: Sat, 02 Apr 2011 21:05:05 GMT User-Agent: Mozilla/5.0 Server: lighttpd/1.4.19 (Macintosh) Content-Type: text/html <html>...</html>
  • 6. ReST - HTTP HTTP Verb ● GET ● POST ● PUT ● DELETE Routes ● URL + HTTP Verb
  • 7. ReST - Definition “The Same Thing with a different STATE changes its meaning” “The message is changed based on it's State”
  • 8. ReST – How To ● Loved by developer ● Easy to read, easy to understand, easy to learn
  • 9. ReST Bad !! Imagine :) /getAllUsers /getMentions /getUserById /getUserTimeLine /getUsers /getHomeTimeLine /deleteUser /getStatusesRetweet /updateUser /updateStatuses /deleteUserTenYearsOld /destroyStatus /newUser /getRetweets /getUserUnderTenYearsOld
  • 10. ReST - Quotes “Web it's not about HTML pages, it's about resources, and those resources are located by URLs”
  • 11. So ? ● We only need two base URLs as the location of a resource (collection of resource, and single resource) ● Resources is Noun, use Noun :) ● Plural is better Resource POST GET (READ) PUT DELETE (CREATE) (UPDATE) /users Create new List all Users Update All Delete All user Users Users /users/1 - Show User Update User Delete User (with ID = 1) with ID = 1 (if with ID = 1 Exist)
  • 12. Association ? Easy :) GET /departments/1/users POST /departments/1/users PUT /users/123 DELETE /users/123
  • 13. Query Use '?' for Query GET /users?limit=50&offset=100 GET /users?username=indra&birth=1990 GET /users?column=id,name,username,birth GET /users.json (/users.xml)
  • 15. Terima Kasih Glend Maatita @glend_maatita YM : the_entung glend.maatita@kampus.co.id