Your SlideShare is downloading. ×
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Rest and the WCF Web API
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Rest and the WCF Web API


Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. REST and the WCF Web API
    Getting started with REST services and the WCF Web API
    Maurice de Beijer
  • 2. Objectives
    What are REST services
    Why REST instead of SOAP
    The WCF Web API framework
    The next webinar on the 25th of October is about creating HTML5/JavaScript clients for REST services
  • 3. What are REST services
    Representational State Transfer
    A way of creating web services
    Not using the WS-* SOAP specifications
    All about resources
    Not about calling functions, RPC
    Embraces HTTP
    Not just a way of getting data across the wire
    Leverages the structure of the Internet
    MIME Media Types
    HTTP Methods
  • 4. The origin of REST
    Architectural Styles and the Design of Network-based Software Architectures
    By Roy Thomas Fielding
    Chapter 5
    One of the authors of the HTTP specification
  • 5. Why are REST services popular
    Almost every platform supports consuming them
    All you need is an HTTP client stack
    Many services are build around resources
    CRUD style
    Enables very scalable services
    Build around the technology that powers the Internet
  • 6. The WCF Web API framework
    On CodePlex
    Use NuGet from within Visual Studio 2010
    Current version 0.5
    Much better than the original WCF support for REST
    But doesn’t replace it
  • 7. The resource URL
    The URL is the key to a resource (The collection of books) individual book)
    A given URL always returns the same resource
    Deleting one resource doesn’t change the URL of another resource
    But a resource can have multiple URL’s
  • 8. Different request/response formats
    Uses standard HTTP MIME Media Types
    Content Negotiation
    The client specifies a list of acceptable media types
    The server chooses the best supported media type to return
    Good general purpose data format
    Optimised for usage with JavaScript clients
    Custom formats
    Use one of the many IANA types
    Define your own
    Normally prefixed with vnd.
    Example: application/vnd.wordperfect
  • 9. HTTP Status codes
    Tell the client application what happened
    Successful 2xx
    200 OK
    201 Resource created
    Redirection 3xx
    301 Moved Permanently
    Client Error 4xx
    400 Bad request
    404 Not found
    Server Error 5xx
    500 Internal Server Error
    503 Service Unavailable
  • 10. HTTP GET Method
    No side effects
    Can retrieve it as often as you like
    Allows for caching
    Request may never get to the server
    Makes the web as scalable as it is
    Use Accept header to specify the acceptable media type
    Multiple types are supported
    Accept: application/xml
    Accept: application/json
    Accept: image/jpeg, image/*; q=0.5
  • 11. Other HTTP Methods
    Creates new resource
    Returns the URL to the created resource
    PUT or PATCH
    Replaces/updates resource
    PATCH only replaces a part of the resource
    Removes resource
  • 12. Microformats
    Enable a much smarter client application
    Embed allowed actions with a resource
    Client can update the UI based on the resource
    OData is a good example
    Based on AtomPub
    Roll your own
    Or reuse an existing one from IANA
    Set the content-type
    Use your own application/
  • 13. Rest is not perfect
    No metadata
    Little tooling in Visual Studio 2010
    It’s harder than it seems
    There is no official REST standard
    There are many strong opinions about what is REST and what is not
  • 14. Usefull resources
    Essential Windows Communication Foundation 4 Training
    Hypertext Transfer Protocol -- HTTP/1.1
    The Atom Syndication Format
    The Atom Publishing Protocol
    Open Data Protocol (OData)
    WCF Web API Contrib
  • 15. Summary
    REST is all about resources
    CRUD actions
    REST embraces HTTP and the web
    HTTP isn’t just a means of moving bits
    REST services are a good way to build scalable services
    Build on the infrastructure of the web
    REST allows for very flexible services
    You control every part of the message