9/26/2019 - 1:32 PM

[API] HTTP Responses

The following table lists all the methods of ApiController class that returns an object of a class that implements IHttpActionResult interface.

  • BadRequest(): Creates a BadRequestResult object with status code 400.
  • Conflict(): Creates a ConflictResult object with status code 409.
  • Content(): Creates a NegotiatedContentResult with the specified status code and data.
  • Created(): Creates a CreatedNegotiatedContentResult with status code 201 Created.
  • CreatedAtRoute(): Creates a CreatedAtRouteNegotiatedContentResult with status code 201 created.
  • InternalServerError(): Creates an InternalServerErrorResult with status code 500 Internal server error.
  • NotFound(): Creates a NotFoundResult with status code404.
  • Ok(): Creates an OkResult with status code 200.
  • Redirect(): Creates a RedirectResult with status code 302.
  • RedirectToRoute(): Creates a RedirectToRouteResult with status code 302.
  • ResponseMessage(): Creates a ResponseMessageResult with the specified HttpResponseMessage.
  • StatusCode(): Creates a StatusCodeResult with the specified http status code.
  • Unauthorized(): Creates an UnauthorizedResult with status code 401.