This page applies to Apigee and Apigee hybrid.
View
Apigee Edge documentation.
The ParsePayload policy extracts logical operations from structured request payloads (such as JSON-RPC 2.0) into message flow variables. This functionality enables the proxy admin to implement conditional routing logic directly based on client request contents rather than basic resource paths or query parameters.
This policy is an Extensible policy and use of this policy might have cost or utilization implications, depending on your Apigee license. For information on policy types and usage implications, see Policy types.
<ParsePayload> element
Specifies validation parsing properties applied toward application logic evaluation cycles.
| Required? | Required |
| Parent Element | n/a |
| Child Elements |
<Source><PayloadType><Protocol>
|
Syntax
The ParsePayload element uses the following syntax:
<ParsePayload continueOnError="[false|true]" enabled="[true|false]" name="policy_name"> <Source>request</Source> <PayloadType>JSON-RPC-2.0</PayloadType> <Protocol>MCP</Protocol> </ParsePayload>
Example
The following example shows a standard configuration for the ParsePayload policy:
<ParsePayload continueOnError="false" enabled="true" name="parse-payload-mcp"> <Source>request</Source> <PayloadType>JSON-RPC-2.0</PayloadType> <Protocol>MCP</Protocol> </ParsePayload>
<Source>
Indicates the request/response container context processed immediately through runtime evaluations.
<Source>request</Source>
| Attribute | Description | Default | Presence |
|---|---|---|---|
| N/A | Text node value. Must be request or response. |
request |
Optional |
<PayloadType>
Governs overall evaluation structures recognized regarding data processing requirements.
<PayloadType>JSON-RPC-2.0</PayloadType>
| Attribute | Description | Default | Presence |
|---|---|---|---|
| N/A | Text node value. Supported values: JSON-RPC-2.0. |
N/A | Required |
<Protocol>
Determines formatting behaviors corresponding precisely with target interface declarations.
<Protocol>MCP</Protocol>
| Attribute | Description | Default | Presence |
|---|---|---|---|
| N/A | Text node value. Supported value: MCP. |
N/A | Required |
Extracted Flow Variables
Post-parsing routines fill predefined the following flow variables based on the payload.
| Variable Name | Description |
|---|---|
apigee.payload.operation |
Constructed execution identifier.
|
apigee.payload.json-rpc.request.method |
The method field from the JSON-RPC request (e.g., tools/call or tools/list). |
apigee.payload.json-rpc.request.id |
The id field from the JSON-RPC request. |
apigee.payload.json-rpc.request.params.name |
The name field inside params (populated for tools/call to identify the tool). |
apigee.payload.json-rpc.request.params.arguments.{arg_name} |
Arguments passed in the arguments object. String values are stored directly; nested objects or arrays are stored as serialized JSON strings. |
Example
For the following JSON-RPC request payload with simple arguments:
{ "jsonrpc": "2.0", "id": "req_001", "method": "tools/call", "params": { "name": "get_weather", "arguments": { "location": "San Francisco, CA", "forecast_days": 3 } } }
The policy populates the following variables:
| Variable | Value |
|---|---|
apigee.payload.operation |
tools/call/get_weather |
apigee.payload.json-rpc.request.method |
tools/call |
apigee.payload.json-rpc.request.id |
req_001 |
apigee.payload.json-rpc.request.params.name |
get_weather |
apigee.payload.json-rpc.request.params.arguments.location |
San Francisco, CA |
apigee.payload.json-rpc.request.params.arguments.forecast_days |
3 |