SlideShare a Scribd company logo
1 of 18
Download to read offline
HOW {TO}
         BUILD A WEB SERVICE
                        1
Sunday, October 9, 11
OVERVIEW
                    I.    REST API
                    II.   DATA FORMATS - (JSON vs XML)
                    III. Request

                    IV. Response




                                                 2
Sunday, October 9, 11
NEED TO KNOW
                    I.   HTTP
                         I.     Methods
                         II.    Headers
                         III.   Status Codes




                                               3
Sunday, October 9, 11
HOW TO
                    I.    Troubleshooting
                    II.   Tools
                    III. PHP Frameworks




                                            4
Sunday, October 9, 11
/**
      * Representational State Transfer
      */



                   REST

                                          5
Sunday, October 9, 11
/**
      * Representational State Transfer
      */
                 - use HTTP methods to determine action.
                 - use HTTP headers identify specifics of
                        the request and how to handle the
                        response


                                            6
Sunday, October 9, 11
/**
      * USEFUL HTTP METHODS
      */
           - GET: retrieve resource representation (read*)
                 - POST: create* new resource
                 - PUT: update* resource
                 - DELETE*



                                                7
Sunday, October 9, 11
/**
      * USEFUL HTTP HEADERS
      */
           - Accept and Content-Type: used for content format
             negotiation
                 - User-Agent: Identify what made the request




                                             8
Sunday, October 9, 11
/**
      * HTTP STATUS CODES
      */
           - 200: OK                     - 404: Not Found
                 - 301: Moved            - 500: Server Error
                 - 302: Found            - Custom *
                 - 401: Not Authorized
                 - 403: Forbidden


                                         9
Sunday, October 9, 11
/**
           * JSON vs XML
           */



                   DATA FORMATS

                           10
Sunday, October 9, 11
/**
      * JSON: JavaScript Object Notation
      */
             Pros
                 - Comes standard in PHP
                 - Light
                 - Great for devices



                                           11
Sunday, October 9, 11
/**
      * JSON: JavaScript Object Notation
      */
             Cons
                 - Hard to distinguish Object vs Array in php
                 - Not as descriptive




                                               12
Sunday, October 9, 11
/**
        * XML
      */
             Pros
                - Verbose and Precise
                - Great for Machine to Machine
                - Inherent style depending on the client.



                                              13
Sunday, October 9, 11
/**
      * XML
      */
                        Cons
                - Heavy
                - Multiple PHP libraries / parsers
                - Multiple standard formats (plain, rss, atom etc)



                                              14
Sunday, October 9, 11
/**
           * Request and Respond
           */
             - Resource are always in plural
                        http://api.local.ws/users/1

                - When no identifier is present, the collection is the
                        resource
                        http://api.local.ws/users

                - Respond with appropriate status code


                                               15
Sunday, October 9, 11
/**
           * Tools
           */
             - Apigee                        - PHP
                                               (curl,file_get_contents)
                - YQL                        - any http client*
                - Charles                    - RESTClient
                - Browser (GET, POST)
                - Packet Sniffers


                                        16
Sunday, October 9, 11
DO IT
                           17
Sunday, October 9, 11
MOSES NGONE
                         @mosesngone
                         moses@epiclabs.com
                         http://mospired.com

                        THANK YOU
                                        18
Sunday, October 9, 11

More Related Content

Similar to How To Build A Web Service

Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)benwaine
 
Introduction to Solr
Introduction to SolrIntroduction to Solr
Introduction to SolrErik Hatcher
 
Apachecon 2011 stanbol_ogrisel
Apachecon 2011 stanbol_ogriselApachecon 2011 stanbol_ogrisel
Apachecon 2011 stanbol_ogriselNuxeo
 
Apache Stanbol 
and the Web of Data - ApacheCon 2011
Apache Stanbol 
and the Web of Data - ApacheCon 2011Apache Stanbol 
and the Web of Data - ApacheCon 2011
Apache Stanbol 
and the Web of Data - ApacheCon 2011Nuxeo
 
A Unified SOAP/JSON API with Symfony2
A Unified SOAP/JSON API with Symfony2A Unified SOAP/JSON API with Symfony2
A Unified SOAP/JSON API with Symfony2Craig Marvelley
 
Effective Web Application Development with Apache Sling
Effective Web Application Development with Apache SlingEffective Web Application Development with Apache Sling
Effective Web Application Development with Apache SlingRobert Munteanu
 
Big Data & Cloud | Cloud Storage Simplified | Adrian Cole
Big Data & Cloud | Cloud Storage Simplified | Adrian ColeBig Data & Cloud | Cloud Storage Simplified | Adrian Cole
Big Data & Cloud | Cloud Storage Simplified | Adrian ColeJAX London
 
Apache Flume NG
Apache Flume NGApache Flume NG
Apache Flume NGhuguk
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby ConferenceJohn Woodell
 
Linked data based semantic annotation using Drupal and Apache Stanbol
Linked data based semantic annotation using Drupal and Apache StanbolLinked data based semantic annotation using Drupal and Apache Stanbol
Linked data based semantic annotation using Drupal and Apache StanbolGabriel Dragomir
 
Your first rails app - 2
 Your first rails app - 2 Your first rails app - 2
Your first rails app - 2Blazing Cloud
 
Mapnik2 Performance, September 2011
Mapnik2 Performance, September 2011Mapnik2 Performance, September 2011
Mapnik2 Performance, September 2011Development Seed
 
QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!Matt Butcher
 
Servicios y Herramientas para usar en tu próximo proyecto
Servicios y Herramientas para usar en tu próximo proyectoServicios y Herramientas para usar en tu próximo proyecto
Servicios y Herramientas para usar en tu próximo proyectoOrlando Del Aguila
 

Similar to How To Build A Web Service (20)

Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)Acceptance & Integration Testing With Behat (PHPNw2011)
Acceptance & Integration Testing With Behat (PHPNw2011)
 
Ruby off Rails
Ruby off RailsRuby off Rails
Ruby off Rails
 
Introduction to Solr
Introduction to SolrIntroduction to Solr
Introduction to Solr
 
Cors michael
Cors michaelCors michael
Cors michael
 
Apachecon 2011 stanbol_ogrisel
Apachecon 2011 stanbol_ogriselApachecon 2011 stanbol_ogrisel
Apachecon 2011 stanbol_ogrisel
 
Apache Stanbol 
and the Web of Data - ApacheCon 2011
Apache Stanbol 
and the Web of Data - ApacheCon 2011Apache Stanbol 
and the Web of Data - ApacheCon 2011
Apache Stanbol 
and the Web of Data - ApacheCon 2011
 
XQuery Design Patterns
XQuery Design PatternsXQuery Design Patterns
XQuery Design Patterns
 
A Unified SOAP/JSON API with Symfony2
A Unified SOAP/JSON API with Symfony2A Unified SOAP/JSON API with Symfony2
A Unified SOAP/JSON API with Symfony2
 
eZ Publish nextgen
eZ Publish nextgeneZ Publish nextgen
eZ Publish nextgen
 
Effective Web Application Development with Apache Sling
Effective Web Application Development with Apache SlingEffective Web Application Development with Apache Sling
Effective Web Application Development with Apache Sling
 
Big Data & Cloud | Cloud Storage Simplified | Adrian Cole
Big Data & Cloud | Cloud Storage Simplified | Adrian ColeBig Data & Cloud | Cloud Storage Simplified | Adrian Cole
Big Data & Cloud | Cloud Storage Simplified | Adrian Cole
 
Apache Flume NG
Apache Flume NGApache Flume NG
Apache Flume NG
 
Red Dirt Ruby Conference
Red Dirt Ruby ConferenceRed Dirt Ruby Conference
Red Dirt Ruby Conference
 
Linked data based semantic annotation using Drupal and Apache Stanbol
Linked data based semantic annotation using Drupal and Apache StanbolLinked data based semantic annotation using Drupal and Apache Stanbol
Linked data based semantic annotation using Drupal and Apache Stanbol
 
Your first rails app - 2
 Your first rails app - 2 Your first rails app - 2
Your first rails app - 2
 
Mapnik2 Performance, September 2011
Mapnik2 Performance, September 2011Mapnik2 Performance, September 2011
Mapnik2 Performance, September 2011
 
QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!QueryPath: It's like PHP jQuery in Drupal!
QueryPath: It's like PHP jQuery in Drupal!
 
Cartoset
CartosetCartoset
Cartoset
 
Servicios y Herramientas para usar en tu próximo proyecto
Servicios y Herramientas para usar en tu próximo proyectoServicios y Herramientas para usar en tu próximo proyecto
Servicios y Herramientas para usar en tu próximo proyecto
 
Vertx
VertxVertx
Vertx
 

Recently uploaded

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
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
 
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
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
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
 
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
 
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.pptxRustici Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdfSandro Moreira
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Victor Rentea
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusZilliz
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelDeepika Singh
 

Recently uploaded (20)

DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
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
 
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
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
+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...
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
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
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
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
 
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...
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 

How To Build A Web Service

  • 1. HOW {TO} BUILD A WEB SERVICE 1 Sunday, October 9, 11
  • 2. OVERVIEW I. REST API II. DATA FORMATS - (JSON vs XML) III. Request IV. Response 2 Sunday, October 9, 11
  • 3. NEED TO KNOW I. HTTP I. Methods II. Headers III. Status Codes 3 Sunday, October 9, 11
  • 4. HOW TO I. Troubleshooting II. Tools III. PHP Frameworks 4 Sunday, October 9, 11
  • 5. /** * Representational State Transfer */ REST 5 Sunday, October 9, 11
  • 6. /** * Representational State Transfer */ - use HTTP methods to determine action. - use HTTP headers identify specifics of the request and how to handle the response 6 Sunday, October 9, 11
  • 7. /** * USEFUL HTTP METHODS */ - GET: retrieve resource representation (read*) - POST: create* new resource - PUT: update* resource - DELETE* 7 Sunday, October 9, 11
  • 8. /** * USEFUL HTTP HEADERS */ - Accept and Content-Type: used for content format negotiation - User-Agent: Identify what made the request 8 Sunday, October 9, 11
  • 9. /** * HTTP STATUS CODES */ - 200: OK - 404: Not Found - 301: Moved - 500: Server Error - 302: Found - Custom * - 401: Not Authorized - 403: Forbidden 9 Sunday, October 9, 11
  • 10. /** * JSON vs XML */ DATA FORMATS 10 Sunday, October 9, 11
  • 11. /** * JSON: JavaScript Object Notation */ Pros - Comes standard in PHP - Light - Great for devices 11 Sunday, October 9, 11
  • 12. /** * JSON: JavaScript Object Notation */ Cons - Hard to distinguish Object vs Array in php - Not as descriptive 12 Sunday, October 9, 11
  • 13. /** * XML */ Pros - Verbose and Precise - Great for Machine to Machine - Inherent style depending on the client. 13 Sunday, October 9, 11
  • 14. /** * XML */ Cons - Heavy - Multiple PHP libraries / parsers - Multiple standard formats (plain, rss, atom etc) 14 Sunday, October 9, 11
  • 15. /** * Request and Respond */ - Resource are always in plural http://api.local.ws/users/1 - When no identifier is present, the collection is the resource http://api.local.ws/users - Respond with appropriate status code 15 Sunday, October 9, 11
  • 16. /** * Tools */ - Apigee - PHP (curl,file_get_contents) - YQL - any http client* - Charles - RESTClient - Browser (GET, POST) - Packet Sniffers 16 Sunday, October 9, 11
  • 17. DO IT 17 Sunday, October 9, 11
  • 18. MOSES NGONE @mosesngone moses@epiclabs.com http://mospired.com THANK YOU 18 Sunday, October 9, 11

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n