Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
HOW {TO}         BUILD A WEB SERVICE                        1Sunday, October 9, 11
OVERVIEW                    I.    REST API                    II.   DATA FORMATS - (JSON vs XML)                    III. R...
NEED TO KNOW                    I.   HTTP                         I.     Methods                         II.    Headers   ...
HOW TO                    I.    Troubleshooting                    II.   Tools                    III. PHP Frameworks     ...
/**      * Representational State Transfer      */                   REST                                          5Sunday...
/**      * Representational State Transfer      */                 - use HTTP methods to determine action.                ...
/**      * USEFUL HTTP METHODS      */           - GET: retrieve resource representation (read*)                 - POST: c...
/**      * USEFUL HTTP HEADERS      */           - Accept and Content-Type: used for content format             negotiatio...
/**      * HTTP STATUS CODES      */           - 200: OK                     - 404: Not Found                 - 301: Moved...
/**           * JSON vs XML           */                   DATA FORMATS                           10Sunday, October 9, 11
/**      * JSON: JavaScript Object Notation      */             Pros                 - Comes standard in PHP              ...
/**      * JSON: JavaScript Object Notation      */             Cons                 - Hard to distinguish Object vs Array...
/**        * XML      */             Pros                - Verbose and Precise                - Great for Machine to Machi...
/**      * XML      */                        Cons                - Heavy                - Multiple PHP libraries / parser...
/**           * Request and Respond           */             - Resource are always in plural                        http:/...
/**           * Tools           */             - Apigee                        - PHP                                      ...
DO IT                           17Sunday, October 9, 11
MOSES NGONE                         @mosesngone                         moses@epiclabs.com                         http://...
Upcoming SlideShare
Loading in …5
×

How To Build A Web Service

775 views

Published on

Covers the concepts on how to build a web service (Rest API), data formats (JSON vs XML), HTTP, troubleshooting your API, tools and how to bring it all together in PHP.

Published in: Technology
  • Be the first to comment

How To Build A Web Service

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

×