Learn the different options in ASP.NET Web API for returning data out of your controller methods.
- [Instructor] Web API allows you to use…many different mechanisms for returning data…from your API.…Each though has its own pros and cons…so let's look at each one so that you can select…the correct one in different situations…within your application.…There are four different return types…that are commonly used in web API applications…and the first of these is to return void.…That is to return nothing at all.…This is an option I wouldn't recommend…that you use very often though.…It's usually preferable to give some sort of feedback…from your API even if it's just a simple boolean…or confirmation message.…
Returning void doesn't allow you to give any feedback…to the application calling your API…about what happened within it.…So returning void is uncommon in a well designed…web API project.…Second option is to return an HTTP response message.…This is an object that fairly directly…represents the actual HTTP response…that will be generated and it allows us…to generate our own custom responses.…The disadvantage is that when we use this return type,…
AuthorJonathan "J." Tower
- Convention-based routing
- Binding your code to an HTTP request
- Validating models
- Using attributes to route requests
- Customizing attribute routes
- Data serialization and model binding
- Error handling
- Using exception filters and exception loggers
- API documentation and testing
- Securing your API
Skill Level Beginner
1. Controllers and Actions
3. Data Serialization and Model Binding
4. Error Handling
5. API Documentation and Testing
Next steps1m 38s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.