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

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embeddingZilliz
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 

Recently uploaded (20)

"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Training state-of-the-art general text embedding
Training state-of-the-art general text embeddingTraining state-of-the-art general text embedding
Training state-of-the-art general text embedding
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 

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