| title | Azure API Management policy reference - validate-odata-request | Microsoft Docs | |
|---|---|---|
| description | Reference for the validate-odata-request policy available for use in Azure API Management. Provides policy usage, settings, and examples. | |
| services | api-management | |
| author | dlepow | |
| ms.service | azure-api-management | |
| ms.custom |
|
|
| ms.topic | reference | |
| ms.date | 07/23/2024 | |
| ms.author | danlep |
[!INCLUDE api-management-availability-all-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.
<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" />| 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 |
- Policy sections: inbound
- Policy scopes: global, workspace, product, API
- Gateways: classic, v2, consumption, self-hosted, workspace
- 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.
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" /> [!INCLUDE api-management-policy-ref-next-steps]