SlideShare ist ein Scribd-Unternehmen logo
1 von 23
Background
REST (Representational State Transfer)
  What does it mean to be RESTful?
  Why REST?
WCF
  How does WCF support REST?
  What are the pieces we need to add?
Chess
  A RESTful Chess API
Open Your API – 2005
MySpace API roadmap
Where are we today ?
  developer.myspace.com
Public interface for 3rd party clients and
partners to view, add, update, delete data.
Easily consumable by any client
Follows established industry standards
Needs to be highly scalable
Supports different data interchange formats
Moderately securable
Test’s we did
.

WCF
REST
What does it mean to be RESTful?
 Power combo: URI and HTTP Method
    Addressable, hierarchical URIs represent the
    entities or objects on your API
    HTTP Method represents the action to be
    taken on the resource
 Connectedness and Discoverability
    Like the Web, Http Responses contain links to
    other resources
 Roy Fielding dissertation
 http://www.ics.uci.edu/~fielding/pubs/dissert
 ation/top.htm
Benefits of REST for Web APIs
  Low barrier of entry
  ROA follows Web Semantics
convenient for
  Web Service APIs.
  Flexibility in Response formats
REST is best choice when creating a
general API when clients are unknown
The “Web Programming Model”

 URI Templates & WebGet/WebInvoke
    Attribute based definitions of URI template and HTTP
    method provide mapping of incoming request URIs to
    methods
 WebHttpBinding
    The binding that enables above
 WebOperationContext
 For more information:
    Building Applications and Services with .NET Framework 3.5
    San Polo 3501A, M10:15 AM March 6th
The 20%

 Flexible URIs
 Bridging Low REST clients
 Request Authentication via Digital Signing
 Extending WebOperationContext
 Multiple Representation Formats
 RESTful Exception Handling
Problems


 Service .svc extension
   Required when hosting a WCF service in IIS
 Can’t use custom extensions in templates
   What if I want to let the URI extension define
   the representation format?
Solutions


 Use URL Rewriter implemented as an
 HttpModule
    Add .svc service file to incoming request URI
    Use extension format in path hierarchy and
    rewrite URI accordingly
High: support for full set of HTTP methods
Low: only support GET and POST
Allow clients to override HTTP method
  Using X-HTTPMethodOverride header
  Use of _method query parameter
Extending WCF
Channels to the Rescue
OAuth

 Introducing OAuth
   Standards based API authentication
 Standard access delegation between
 Consumer and Provider
 Standard digital signing mechanism
 oauth.net
OAuth

 WCF Custom Channels to the rescue again
   Channel will authenticate request before
   method dispatch
 Extend Context with application data
MySpace Development Platform is RESTful
  WCF is a powerful web API development
  platform
  WCF has great extension points
  All demo source available at
  RestChess.com

MySpace API’s are available
Visit developer.myspace.com
© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.
The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market
     conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation.
                                 MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.
Creating a RESTful API with Windows Communication Foundation

Weitere Àhnliche Inhalte

Mehr von goodfriday

Narine Presentations 20051021 134052
Narine Presentations 20051021 134052Narine Presentations 20051021 134052
Narine Presentations 20051021 134052
goodfriday
 
Triunemar05
Triunemar05Triunemar05
Triunemar05
goodfriday
 
09 03 22 easter
09 03 22 easter09 03 22 easter
09 03 22 easter
goodfriday
 
Holy Week Easter 2009
Holy Week Easter 2009Holy Week Easter 2009
Holy Week Easter 2009
goodfriday
 
Holt Park Easter 09 Swim
Holt Park Easter 09 SwimHolt Park Easter 09 Swim
Holt Park Easter 09 Swim
goodfriday
 
Easter Letter
Easter LetterEaster Letter
Easter Letter
goodfriday
 
April2009
April2009April2009
April2009
goodfriday
 
Swarthmore Lentbrochure20092
Swarthmore Lentbrochure20092Swarthmore Lentbrochure20092
Swarthmore Lentbrochure20092
goodfriday
 
Eastercard2009
Eastercard2009Eastercard2009
Eastercard2009
goodfriday
 
Easterservices2009
Easterservices2009Easterservices2009
Easterservices2009
goodfriday
 
Bulletin Current
Bulletin CurrentBulletin Current
Bulletin Current
goodfriday
 
Easter2009
Easter2009Easter2009
Easter2009
goodfriday
 
Bulletin
BulletinBulletin
Bulletin
goodfriday
 
March 2009 Newsletter
March 2009 NewsletterMarch 2009 Newsletter
March 2009 Newsletter
goodfriday
 
Mar 29 2009
Mar 29 2009Mar 29 2009
Mar 29 2009
goodfriday
 
Lent Easter 2009
Lent Easter 2009Lent Easter 2009
Lent Easter 2009
goodfriday
 
Easterpowersports09
Easterpowersports09Easterpowersports09
Easterpowersports09
goodfriday
 
Easter Trading 09
Easter Trading 09Easter Trading 09
Easter Trading 09
goodfriday
 
Easter Brochure 2009
Easter Brochure 2009Easter Brochure 2009
Easter Brochure 2009
goodfriday
 
March April 2009 Calendar
March April 2009 CalendarMarch April 2009 Calendar
March April 2009 Calendar
goodfriday
 

Mehr von goodfriday (20)

Narine Presentations 20051021 134052
Narine Presentations 20051021 134052Narine Presentations 20051021 134052
Narine Presentations 20051021 134052
 
Triunemar05
Triunemar05Triunemar05
Triunemar05
 
09 03 22 easter
09 03 22 easter09 03 22 easter
09 03 22 easter
 
Holy Week Easter 2009
Holy Week Easter 2009Holy Week Easter 2009
Holy Week Easter 2009
 
Holt Park Easter 09 Swim
Holt Park Easter 09 SwimHolt Park Easter 09 Swim
Holt Park Easter 09 Swim
 
Easter Letter
Easter LetterEaster Letter
Easter Letter
 
April2009
April2009April2009
April2009
 
Swarthmore Lentbrochure20092
Swarthmore Lentbrochure20092Swarthmore Lentbrochure20092
Swarthmore Lentbrochure20092
 
Eastercard2009
Eastercard2009Eastercard2009
Eastercard2009
 
Easterservices2009
Easterservices2009Easterservices2009
Easterservices2009
 
Bulletin Current
Bulletin CurrentBulletin Current
Bulletin Current
 
Easter2009
Easter2009Easter2009
Easter2009
 
Bulletin
BulletinBulletin
Bulletin
 
March 2009 Newsletter
March 2009 NewsletterMarch 2009 Newsletter
March 2009 Newsletter
 
Mar 29 2009
Mar 29 2009Mar 29 2009
Mar 29 2009
 
Lent Easter 2009
Lent Easter 2009Lent Easter 2009
Lent Easter 2009
 
Easterpowersports09
Easterpowersports09Easterpowersports09
Easterpowersports09
 
Easter Trading 09
Easter Trading 09Easter Trading 09
Easter Trading 09
 
Easter Brochure 2009
Easter Brochure 2009Easter Brochure 2009
Easter Brochure 2009
 
March April 2009 Calendar
March April 2009 CalendarMarch April 2009 Calendar
March April 2009 Calendar
 

KĂŒrzlich hochgeladen

Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

KĂŒrzlich hochgeladen (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 

Creating a RESTful API with Windows Communication Foundation

  • 1.
  • 2. Background REST (Representational State Transfer) What does it mean to be RESTful? Why REST? WCF How does WCF support REST? What are the pieces we need to add? Chess A RESTful Chess API
  • 3. Open Your API – 2005 MySpace API roadmap Where are we today ? developer.myspace.com
  • 4. Public interface for 3rd party clients and partners to view, add, update, delete data. Easily consumable by any client Follows established industry standards Needs to be highly scalable Supports different data interchange formats Moderately securable
  • 6. What does it mean to be RESTful? Power combo: URI and HTTP Method Addressable, hierarchical URIs represent the entities or objects on your API HTTP Method represents the action to be taken on the resource Connectedness and Discoverability Like the Web, Http Responses contain links to other resources Roy Fielding dissertation http://www.ics.uci.edu/~fielding/pubs/dissert ation/top.htm
  • 7. Benefits of REST for Web APIs Low barrier of entry ROA follows Web Semantics
convenient for Web Service APIs. Flexibility in Response formats REST is best choice when creating a general API when clients are unknown
  • 8.
  • 9. The “Web Programming Model” URI Templates & WebGet/WebInvoke Attribute based definitions of URI template and HTTP method provide mapping of incoming request URIs to methods WebHttpBinding The binding that enables above WebOperationContext For more information: Building Applications and Services with .NET Framework 3.5 San Polo 3501A, M10:15 AM March 6th
  • 10.
  • 11. The 20% Flexible URIs Bridging Low REST clients Request Authentication via Digital Signing Extending WebOperationContext Multiple Representation Formats RESTful Exception Handling
  • 12. Problems
 Service .svc extension Required when hosting a WCF service in IIS Can’t use custom extensions in templates What if I want to let the URI extension define the representation format?
  • 13. Solutions
 Use URL Rewriter implemented as an HttpModule Add .svc service file to incoming request URI Use extension format in path hierarchy and rewrite URI accordingly
  • 14.
  • 15. High: support for full set of HTTP methods Low: only support GET and POST Allow clients to override HTTP method Using X-HTTPMethodOverride header Use of _method query parameter Extending WCF
Channels to the Rescue
  • 16.
  • 17. OAuth Introducing OAuth Standards based API authentication Standard access delegation between Consumer and Provider Standard digital signing mechanism oauth.net
  • 18. OAuth WCF Custom Channels to the rescue again Channel will authenticate request before method dispatch Extend Context with application data
  • 19.
  • 20.
  • 21. MySpace Development Platform is RESTful WCF is a powerful web API development platform WCF has great extension points All demo source available at RestChess.com MySpace API’s are available Visit developer.myspace.com
  • 22. © 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.