Skip to content

Files

Latest commit

 

History

History
69 lines (57 loc) · 14.1 KB

api-management-validation-policy-error-reference.md

File metadata and controls

69 lines (57 loc) · 14.1 KB
author ms.service ms.topic ms.date ms.author
dlepow
api-management
include
12/05/2022
danlep

Validation errors

API Management generates content validation errors in the following format:

{
 "Name": string,
 "Type": string,
 "ValidationRule": string,
 "Details": string,
 "Action": string
}

The following table lists all possible errors of the validation policies.

  • Details: Can be used to investigate errors. Not meant to be shared publicly.
  • Public response: Error returned to the client. Does not leak implementation details.

When a validation policy specifies the prevent action and produces an error, the response from API management includes an HTTP status code: 400 when the policy is applied in the inbound section, and 502 when the policy is applied in the outbound section.

Name Type Validation rule Details Public response Action
validate-content
RequestBody SizeLimit Request's body is {size} bytes long and it exceeds the configured limit of {maxSize} bytes. Request's body is {size} bytes long and it exceeds the limit of {maxSize} bytes. detect / prevent
ResponseBody SizeLimit Response's body is {size} bytes long and it exceeds the configured limit of {maxSize} bytes. The request could not be processed due to an internal error. Contact the API owner. detect / prevent
{messageContentType} RequestBody Unspecified Unspecified content type {messageContentType} is not allowed. Unspecified content type {messageContentType} is not allowed. detect / prevent
{messageContentType} ResponseBody Unspecified Unspecified content type {messageContentType} is not allowed. The request could not be processed due to an internal error. Contact the API owner. detect / prevent
ApiSchema API's schema does not exist or it could not be resolved. The request could not be processed due to an internal error. Contact the API owner. detect / prevent
ApiSchema API's schema does not specify definitions. The request could not be processed due to an internal error. Contact the API owner. detect / prevent
{messageContentType} RequestBody / ResponseBody MissingDefinition API's schema does not contain definition {definitionName}, which is associated with the content type {messageContentType}. The request could not be processed due to an internal error. Contact the API owner. detect / prevent
{messageContentType} RequestBody IncorrectMessage Body of the request does not conform to the definition {definitionName}, which is associated with the content type {messageContentType}.

{valError.Message} Line: {valError.LineNumber}, Position: {valError.LinePosition}
Body of the request does not conform to the definition {definitionName}, which is associated with the content type {messageContentType}.

{valError.Message} Line: {valError.LineNumber}, Position: {valError.LinePosition}
detect / prevent
{messageContentType} ResponseBody IncorrectMessage Body of the response does not conform to the definition {definitionName}, which is associated with the content type {messageContentType}.

{valError.Message} Line: {valError.LineNumber}, Position: {valError.LinePosition}
The request could not be processed due to an internal error. Contact the API owner. detect / prevent
RequestBody ValidationException Body of the request cannot be validated for the content type {messageContentType}.

{exception details}
The request could not be processed due to an internal error. Contact the API owner. detect / prevent
ResponseBody ValidationException Body of the response cannot be validated for the content type {messageContentType}.

{exception details}
The request could not be processed due to an internal error. Contact the API owner. detect / prevent
validate-parameters / validate-headers
{paramName} / {headerName} QueryParameter / PathParameter / RequestHeader Unspecified Unspecified {path parameter / query parameter / header} {paramName} is not allowed. Unspecified {path parameter / query parameter / header} {paramName} is not allowed. detect / prevent
{headerName} ResponseHeader Unspecified Unspecified header {headerName} is not allowed. The request could not be processed due to an internal error. Contact the API owner. detect / prevent
ApiSchema API's schema doesn't exist or it couldn't be resolved. The request could not be processed due to an internal error. Contact the API owner. detect / prevent
ApiSchema API schema does not specify definitions. The request could not be processed due to an internal error. Contact the API owner. detect / prevent
{paramName} QueryParameter / PathParameter / RequestHeader / ResponseHeader MissingDefinition API's schema does not contain definition {definitionName}, which is associated with the {query parameter / path parameter / header} {paramName}. The request could not be processed due to an internal error. Contact the API owner. detect / prevent
{paramName} QueryParameter / PathParameter / RequestHeader IncorrectMessage Request cannot contain multiple values for the {query parameter / path parameter / header} {paramName}. Request cannot contain multiple values for the {query parameter / path parameter / header} {paramName}. detect / prevent
{headerName} ResponseHeader IncorrectMessage Response cannot contain multiple values for the header {headerName}. The request could not be processed due to an internal error. Contact the API owner. detect / prevent
{paramName} QueryParameter / PathParameter / RequestHeader IncorrectMessage Value of the {query parameter / path parameter / header} {paramName} does not conform to the definition.

{valError.Message} Line: {valError.LineNumber}, Position: {valError.LinePosition}
The value of the {query parameter / path parameter / header} {paramName} does not conform to the definition.

{valError.Message} Line: {valError.LineNumber}, Position: {valError.LinePosition}
detect / prevent
{headerName} ResponseHeader IncorrectMessage Value of the header {headerName} does not conform to the definition.

{valError.Message} Line: {valError.LineNumber}, Position: {valError.LinePosition}
The request could not be processed due to an internal error. Contact the API owner. detect / prevent
{paramName} QueryParameter / PathParameter / RequestHeader IncorrectMessage Value of the {query parameter / path parameter / header} {paramName} cannot be parsed according to the definition.

{ex.Message}
Value of the {query parameter / path parameter / header} {paramName} couldn't be parsed according to the definition.

{ex.Message}
detect / prevent
{headerName} ResponseHeader IncorrectMessage Value of the header {headerName} couldn't be parsed according to the definition. The request could not be processed due to an internal error. Contact the API owner. detect / prevent
{paramName} QueryParameter / PathParameter / RequestHeader ValidationError {Query parameter / Path parameter / Header} {paramName} cannot be validated.

{exception details}
The request could not be processed due to an internal error. Contact the API owner. detect / prevent
{headerName} ResponseHeader ValidationError Header {headerName} cannot be validated.

{exception details}
The request could not be processed due to an internal error. Contact the API owner. detect / prevent
validate-status-code
{status-code} StatusCode Unspecified Response status code {status-code} is not allowed. The request could not be processed due to an internal error. Contact the API owner. detect / prevent

The following table lists all the possible Reason values of a validation error along with possible Message values:

Reason Message
Bad request {Details} for context variable, {Public response} for client
Response not allowed {Details} for context variable, {Public response} for client