({{, (RefLink[HTTPErrorResponse, paclet:ref/HTTPErrorResponse])[code] 
is an object that represents an error response to an HTTP request, with specified error code.}})

OpenersNotesSection(Spacer1)Details

Typical error codes include:

(RefLink[HTTPErrorResponse, paclet:ref/HTTPErrorResponse]) is typically specified as a result from constructs such as (RefLink[APIFunction, paclet:ref/APIFunction]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Manually generate the (RefLink[HTTPResponse, paclet:ref/HTTPResponse]):

GenerateHTTPResponse[HTTPErrorResponse[500]]

Return a page not found from a (RefLink[Delayed, paclet:ref/Delayed]):

CloudDeploy[Delayed@If[Now ≤ DateObject[{2020,1,1}], HTTPErrorResponse[404], "HelloWorld!"]]

Return a 404 from an (RefLink[APIFunction, paclet:ref/APIFunction]):

CloudDeploy[APIFunction["x" -> "Number", If[0≤ #x ≤ 100, "Hello World", HTTPErrorResponse[404]]&]]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[HTTPResponse, paclet:ref/HTTPResponse])  ▪  (RefLink[HTTPRedirect, paclet:ref/HTTPRedirect])  ▪  (RefLink[HTTPRequestData, paclet:ref/HTTPRequestData])  ▪  (RefLink[GenerateHTTPResponse, paclet:ref/GenerateHTTPResponse])  ▪  (RefLink[APIFunction, paclet:ref/APIFunction])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Creating Instant APIs, paclet:guide/CreatingAnInstantAPI])}, {▪(RefLinkPlain[Cloud Functions & Deployment, paclet:guide/CloudFunctionsAndDeployment])}, {▪(RefLinkPlain[HTTP Requests & Responses, paclet:guide/HTTPRequestsAndResponses])}})}})