Download presentation
Presentation is loading. Please wait.
1
Introduction to .NET Florin Olariu
“Alexandru Ioan Cuza”, University of Iași Department of Computer Science
2
ASP.NET Web API - II
3
Agenda Status codes recap Demo : How to return child resources
Demo : Working with serializer settings Content negotiation Demo: Content negotiation Demo : Creating a resource Demo : Validating input Demo : Updating a resource Demo : Deleting a resource Best practices in Web API’s Summary
4
Status codes recap
5
Status codes recap
6
Demo : How to return child resources
7
Demo : Working with serializer settings
8
Content negotiation
9
Content negotiation Formatters and Content negotiation
What is the meaning?
10
Content negotiation Formatters and Content negotiation
The idea is selecting the best representation for a given response when the are multiple representation available. In order to solve this goal we have to:
11
Content negotiation Formatters and Content negotiation
The idea is selecting the best representation for a given response when the are multiple representation available. Pass media type via the accept header of the request Sample:
12
Content negotiation Formatters and Content negotiation
The idea is selecting the best representation for a given response when the are multiple representation available. Pass media type via the accept header of the request application/json application/xml Formatters:
13
Content negotiation Deals with: output and input
14
Content negotiation
15
Demo: Content negotiation
16
Demo : Creating a resource
17
Demo : Validating input
ModelState Data validation For custom validations make use of Fluent Validation fluentvalidation/
18
Demo : Updating a resource
19
Demo : Deleting a resource
20
One more thing…(1/2) Postel’s law.
21
Best practices for API’s
One more thing…(2/2) Best practices for API’s common-pitfalls-7a83ba3763b5#.6wmaehuhu
22
Summary Recap status codes Formatters and content negotiation
Creating/updating/deleting updating resources Best practices
23
Bibliography Pluralsight
24
Questions Do you have any other questions?
25
Thanks! See you next time!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.