IHttpActionResult Shortcut Methods
The ApiController in Web API 2 has action methods that return an IHttpActionResult interface. There ApiController class has shortcut methods for creating certain results. From within an Action Method, we can call any other following methods that are associated with certain HTTP status codes:
- BadRequest()
- 400 Bad Request
- Conflict()
- 409 Conflict
- Created()
- 201 Created
- Ok()
- 200 OK
- InternalServerError()
- 500 Internal Server Error
- JSON()
- 200 OK
- Redirect()
- 302 Found
- StatusCode()
- Any
- Unauthorized()
- 401 Unauthorized
- NotFound()
- 404 Not Found
See also
http://msdn.microsoft.com/en-us/library/system.web.http.apicontroller_methods%28v=vs.118%29.aspx