You're
viewing Apigee X documentation.
View Apigee Edge documentation.
When creating an Apigee X proxy with an Integration target, you can configure the set-request-payload
policy to pass input parameters (variables) to your Apigee Integration.
For example, you can configure the parameters
property of the
<Payload/>
block to update the proxy request payload, as shown below:
<Payload contentType="application/json"> { "name":"projects/my-apigee-integration-org/locations/-/integrations/my-integration-name", "trigger_id":"api_trigger/my-trigger-name", "parameters":{ "parameters":{ "key":"json_input_variable_name", "value":{ "json_value":%somePayload# // The value passed here must be a stringified representation of JSON. You can use JSON.stringify to achieve this } } } } </Payload>
Supported parameter types
Apigee Integration supports the following parameter types:
- Strings and String arrays
- Integers and Integer arrays
- Doubles and Double arrays
- Booleans and Boolean arrays
- JSON
Example input parameters
An example parameter configuration for a String
input is shown below:
<Payload contentType="application/json"> { "name":"projects/my-apigee-integration-org/locations/-/integrations/my-integration-name", "trigger_id":"api_trigger/my-trigger-name", "parameters":{ "parameters":{ "key":"Subject", "value":{ "string_value":"OverriddenString" } } } } </Payload>
An example parameter configuration for an Int array
input is shown below:
<Payload contentType="application/json"> { "name":"projects/my-apigee-integration-org/locations/-/integrations/my-integration-name", "trigger_id":"api_trigger/my-trigger-name", "parameters":{ "parameters":{ "key":"randomLongs", "value":{ "int_array":{ "int_values":[ 1, 2, 3 ] } } } } } </Payload>
An example parameter configuration for an JSON
input is shown below:
- Step 1: Stringify the JSON:
var preStringify = context.getVariable("request.content"); var postStringify = JSON.stringify(preStringify); context.setVariable("request.content", postStringify);
- Pass the JSON as input:
<Payload contentType="application/json" variablePrefix="%" variableSuffix="#"> { "name":"projects/my-apigee-integration-org/locations/-/integrations/my-integration-name", "trigger_id":"api_trigger/my-trigger-name", "parameters":{ "parameters":{ "key":"conference_lead", "value":{ "json_value":%request.content# } } } } </Payload>