แก้ไข

แชร์ผ่าน


Validate OData request

APPLIES TO: All API Management tiers

The validate-odata-request policy validates the request URL, headers, and parameters of a request to an OData API to ensure conformance with the OData specification.

Policy statement

<validate-odata-request error-variable-name="variable name" default-odata-version="OData version number" min-odata-version="OData version number" max-odata-version="OData version number" max-size="size in bytes" />

Attributes

Attribute Description Required Default
error-variable-name Name of the variable in context.Variables to log validation errors to. No N/A
default-odata-version The default OData version that is assumed for parameter validation if the request doesn't contain an OData-Version header. No 4.0
min-odata-version The minimum OData version in the OData-Version header of the request that the policy accepts. No N/A
max-odata-version The maximum OData version in the OData-Version header of the request that the policy accepts. No N/A
max-size Maximum size of the request payload in bytes. No N/A

Usage

Usage notes

  • Configure the policy for an OData API that has been imported to API Management.
  • This policy can only be used once in a policy section.

Example

The following example validates a request to an OData API and assumes a default OData version of 4.01 if no OData-Version header is present:

<validate-odata-request default-odata-version="4.01" />  

For more information about working with policies, see: