Skip to content
simonthorogood edited this page Dec 12, 2010 · 3 revisions

OperationResult nested classes

Note that this is a list of commonly-used status codes available as nested classes – used, for example, as

new OperationResult.OK { ResponseResource = myResource };

Where you need to use a status code not listed, simply derive your own OperationResult and ensure you call base(int statusCode) from the constructor(s).

Class name Http Status Code When to use
OperationResult.OK 200 Everything is fine – this is the representation of the resource that you requested
OperationResult.BadRequest 400 Something is wrong with the format of your request
OperationResult.Created 201 The resource you sent has been created
OperationResult.Forbidden 403 Forbidden
OperationResult.Found 302 The resource resides temporarily at another URI
OperationResult.Gone 410 The resource has been permanently removed
OperationResult.InternalServerError 500 Internal Server Error
OperationResult.MethodNotAllowed 405 The HTTP method you used is not allowed for this URI
OperationResult.MovedPermanently 301 The resource has moved permanently
OperationResult.MovedTemporarily 307 The resource has moved temporarily
OperationResult.MultipleRepresentations 300 The resource has multiple representations
OperationResult.NoContent 204 There is no content for this resource
OperationResult.NotFound 404 The resource was not found
OperationResult.NotModified 304 The resource was not modified
OperationResult.RequestMediaTypeUnsupported 415 The media type you sent is not supported at this URI
OperationResult.ResponseMediaTypeUnsupported 406 The media type you requested is not supported at this URI
OperationResult.SeeOther 303 Allows the output of a POST-activated script to redirect to a selected resource.
OperationResult.Unauthorized 401 The client is not authorized to view this resource