title | description | services | author | ms.service | ms.topic | ms.date | ms.author |
---|---|---|---|---|---|---|---|
Azure API Management policy reference - jsonp | Microsoft Docs |
Reference for the jsonp policy available for use in Azure API Management. Provides policy usage, settings, and examples. |
api-management |
dlepow |
azure-api-management |
reference |
07/23/2024 |
danlep |
[!INCLUDE api-management-availability-all-tiers]
The jsonp
policy adds JSON with padding (JSONP) support to an operation or an API to allow cross-domain calls from JavaScript browser-based clients. JSONP is a method used in JavaScript programs to request data from a server in a different domain. JSONP bypasses the limitation enforced by most web browsers where access to web pages must be in the same domain.
[!INCLUDE api-management-policy-generic-alert]
<jsonp callback-parameter-name="callback function name" />
Name | Description | Required | Default |
---|---|---|---|
callback-parameter-name | The cross-domain JavaScript function call prefixed with the fully qualified domain name where the function resides. Policy expressions are allowed. | Yes | N/A |
- Policy sections: outbound
- Policy scopes: global, workspace, product, API, operation
- Gateways: classic, v2, consumption, self-hosted, workspace
- This policy can only be used once in a policy section.
<jsonp callback-parameter-name="cb" />
If you call the method without the callback parameter ?cb=XXX
, it will return plain JSON (without a function call wrapper).
If you add the callback parameter ?cb=XXX
, it will return a JSONP result, wrapping the original JSON results around the callback function like XYZ('<json result goes here>');
[!INCLUDE api-management-policy-ref-next-steps]