How To Build A Web Service

708 views
662 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
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
708
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
26
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • 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

    ×