Loading presentation...

Present Remotely

Send the link below via email or IM


Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.


RESTful Services

A quick overview

Michael Riecken

on 6 June 2013

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of RESTful Services

RESTful Services A Quick Overview How Did We Get Here? The Web Used To
Be Easy.... REST Aims to
Make Things Easy....

Like in the Good Old Days Response Codes We Use the Verbs
Built into the Plumbing
of the World Wide Web Those are the Verbs
of HTTP RESTful Web Services use protocols
built into the HTTP infrastructure of the web. These protocols have always been there. It's just that we
don't use them so much with web pages GET Your Request Returns a Response Code To Make a Web Page
You Need HTTP (X)HTML URIs To Make a Web App
You Need HTTP
URIs Server Code But...
To Make a Web Service
You Need XML
UDDI WS-Policy
WS-Coordination WS-Transaction
WS-Transfer WTF PUT DELETE POST OTHERS PUT Create or Update a Resource PUT /customers/12345 DELETE Delete a Resource http://freegeoip.net/json/gumtree.com.au DELETE /json/gumtree.com.au POST Create a Resource GET Get some resource. http://freegeoip.net/json/gumtree.com.au GET /json/gumtree.comau HTTP/1.0 OTHERS EXAMPLE If Customer 12345 doesn't exist, it is created.

Content is sent in the body of the PUT

Complete Replacement telnet petstore.swagger.wordnik.com 80

POST /api/pet.json?api_key=special-key HTTP/1.1 OPTIONS HEAD TRACE CONNECT PATCH Don't Abuse Them by Making Up Your Own This is OLD NEWS in HTTP 404 4xx - Errors

400 - Bad Request
401 - Unauthorized
402 - Forbidden
404 - Not Found
405 - Method Not Allowed
406 - Not Acceptable
407 - Proxy Authentication Required
408 - Request Timeout
409 - Conflict
410 - Gone
411 - Length Required
412 - Precondition Failed
413 - Request Entity Too Large
414 - Request URI Too Long
415 - Unsupported Media Type
416 - Request Range Not Satisfiable
417 - Expectation Failed 1xx - Informational

100 - Continue
101 - Switching Protocols 2xx - Success

200 - Ok
201 - Created
202 - Accepted
203 - Non-Authoritative Information
204 - No Content
205 - Reset Content
206 - Partial Content 3xx - Redirection300 - Multiple Choices301 - Moved Permanently302 - Found303 - See Other304 - Not Modified305 - Use Proxy307 - Temporary Redirect 5xx - Server Error500 - Internal Server Error501 - Not Implemented502 - Bad Gateway503 - Service Unavailable504 - Gateway Timeout505 - HTTP Version Not Supported It's All In the Name The URIs are Very Important in REST The Verbs are Defined by Convention So that doesn't leave us much to work with... Nouns are PLURAL /api/customers
Gets us all customers api/customers/123
Gets us a specific customer API Version High in the URI /api/v1/cusotmer


/v2.2/pet.json Don't be Afraid to Nest /customers/123/orders/224/lineitem2 Additional Verbs Fielding Says.... Control data defines the purpose of a message between components, such as the action being requested or the meaning of a response. It is also used to parameterize requests and override the default behavior of some connecting elements. For example, cache behavior can be modified by control data included in the request or response message. "INCLUDED IN THE REQUEST OR RESPONSE MESSAGE" Avoid... /api/pet/feed
/api/petCuddle Content is King Responses should reference by URL customer: {
} (Our examples are bad) Developed in parallel with HTTP/1.1
Based on HTTP/1.0 RFC 2616 R. FieldingJ. GettysJ. MogulH. FrystykL. MasinterP. LeachT. Berners-Lee Leonard Richardson Martin Fowler Maturity 1. POX 2. Resources 3. Verbs 4. Hypermedia Controls (Richardson) (Fowler) <appointment>
<slot id = "1234" doctor = "mjones" start = "1400" end = "1450"/>
<patient id = "jsmith"/>
<link rel = "/linkrels/appointment/cancel"
uri = "/slots/1234/appointment"/>
<link rel = "/linkrels/appointment/addTest"
uri = "/slots/1234/appointment/tests"/>
<link rel = "self"
uri = "/slots/1234/appointment"/>
<link rel = "/linkrels/appointment/changeTime"
uri = "/doctors/mjones/slots?date=20100104@status=open"/>
<link rel = "/linkrels/appointment/updateContactInfo"
uri = "/patients/jsmith/contactInfo"/>
<link rel = "/linkrels/help"
uri = "/help/appointment"/>
Full transcript