SetIntegrationRequest policy

This pageapplies toApigee andApigee hybrid.

View Apigee Edge documentation.

The SetIntegrationRequest policy lets you create a request object for an integration that you want to run. In the policy, you must configure the details of the API trigger and the input parameters required to run the integration. When you run the SetIntegrationRequest policy, it creates a request object and saves it in a flow variable. The request object has all the information required to run the integration. At this stage, the integration is still not run. To run the integration, you must either call theIntegrationCallout policy or set anIntegrationEndpoint. Both the IntegrationCallout policy and IntegrationEndpoint require the request object to run the integration.

This policy is anExtensible 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, seePolicy types.

Note:
  • You can run only integrations that have an API trigger.
  • To run an integration, you must use the SetIntegrationRequest policy along with the IntegrationCallout policy or the IntegrationEndpoint.

<SetIntegrationRequest>

Specifies the SetIntegrationRequest policy.

Default ValueN/A
Required?Required
TypeComplex type
Parent Element N/A
Child Elements<ApiTrigger>
<DisplayName>
<IntegrationName>
<IntegrationRegion>
<Parameters>
<ProjectId>
<Request>
<ScheduleTime>

The following table provides a high-level description of the child elements of the<SetIntegrationRequest> element:

Child ElementRequired?Description
<ApiTrigger>RequiredName of the API trigger to call in the integration.
<DisplayName>OptionalA custom name for the policy.
<IntegrationName>OptionalName of the integration to run.
<IntegrationRegion>RequiredName of the region where the integration exists.
<Parameters>OptionalInput parameters of the integration.
<ProjectId>OptionalName of the Google Cloud Project which has the integration that you want to run.
<Request>OptionalName of the flow variable to save the request object.
<ScheduleTime>OptionalThe time at which the integration must be run.

The SetIntegrationRequest policy uses the following syntax:

Syntax

<?xmlversion="1.0"encoding="UTF-8"standalone="no"?><SetIntegrationRequestcontinueOnError="[true|false]"enabled="[true|false]"name="Set-Integration-Request"><DisplayName>POLICY_DISPLAY_NAME</DisplayName><ProjectIdref="FLOW_VARIABLE_NAME">GOOGLE_CLOUD_PROJECT_ID</ProjectId><IntegrationNameref="FLOW_VARIABLE_NAME">INTEGRATION_NAME</IntegrationName><IntegrationRegionref="FLOW_VARIABLE_NAME">INTEGRATION_REGION</IntegrationRegion><ApiTriggerref="FLOW_VARIABLE_NAME">API_TRIGGER_NAME</ApiTrigger><ScheduleTime>PARAMETER_VALUE</ScheduleTime><Parameters><Parametername="PARAMETER_NAME"type="PARAMETER_DATATYPE"ref="FLOW_VARIABLE_NAME">PARAMETER_VALUE</Parameter><ParameterArrayname="ARRAY_NAME"type="ARRAY_DATATYPE"ref="FLOW_VARIABLE_NAME>      <Value ref="FLOW_VARIABLE_NAME>PARAMETER_VALUE</Value><Valueref="FLOW_VARIABLE_NAME>PARAMETER_VALUE</Value>      <Value ref="FLOW_VARIABLE_NAME>PARAMETER_VALUE</Value></ParameterArray></Parameters><Request>FLOW_VARIABLE_NAME</Request></SetIntegrationRequest>

Example

The following example shows the SetIntegrationRequest policy definition:

<?xmlversion="1.0"encoding="UTF-8"standalone="no"?><SetIntegrationRequestcontinueOnError="false"enabled="true"name="Set-Integration-Request"><DisplayName>SetIntegrationRequestPolicy</DisplayName><ProjectIdref="my_projectid_var">apigee_staging_1</ProjectId><IntegrationNameref="my_integration_ref">integration_1</IntegrationName><IntegrationRegionref="my_integration_ref">asia-east1</IntegrationRegion><ApiTriggerref="my_api_trigger_ref">API-Trigger-2</ApiTrigger><ScheduleTime>2022-01-15T01:30:15Z</ScheduleTime><Parameters><Parametername="my_str_param"type="string"ref="flow_var_1">someText</Parameter><ParameterArrayname="my_array_param"type="integer"ref="flow_var_2"><Valueref="flow_var_3">1</Value><Valueref="flow_var_4">2</Value><Valueref="flow_var_5">3</Value></ParameterArray></Parameters><Request>my_request_var</Request></SetIntegrationRequest>

This element has the following attributes that are common to all policies:

AttributeDefaultRequired?Description
nameN/ARequired

The internal name of the policy. The value of thename attribute can contain letters, numbers, spaces, hyphens, underscores, and periods. This value cannot exceed 255 characters.

Optionally, use the<DisplayName> element to label the policy in the management UI proxy editor with a different, natural-language name.

continueOnErrorfalseOptionalSet tofalse to return an error when a policy fails. This is expected behavior for most policies. Set totrue to have flow execution continue even after a policy fails. See also:
enabledtrueOptionalSet totrue to enforce the policy. Set tofalse toturn off the policy. The policy will not be enforced even if it remains attached to a flow.
async  falseDeprecatedThis attribute is deprecated.

Child element reference

This section describes the child elements of<SetIntegrationRequest>.

<DisplayName>

Use in addition to thename attribute to label the policy in the management UI proxy editor with a different, more natural-sounding name.

The<DisplayName> element is common to all policies.

Default ValueN/A
Required?Optional. If you omit<DisplayName>, the value of the policy'sname attribute is used.
TypeString
Parent Element <PolicyElement>
Child Elements None

The<DisplayName> element uses the following syntax:

Syntax

<PolicyElement><DisplayName>POLICY_DISPLAY_NAME</DisplayName>  ...</PolicyElement>

Example

<PolicyElement><DisplayName>My Validation Policy</DisplayName></PolicyElement>

The<DisplayName> element has no attributes or child elements.

<ProjectId>

Specifies the name of the Google Cloud Project.

Apigee assigns the value you specify for this element to theintegration.project.id flow variable.

Default ValueN/A
Required?Optional
TypeString
Parent Element<SetIntegrationRequest>
Child Elements None

The<ProjectId> element uses the following syntax:

Syntax

<ProjectId ref="FLOW_VARIABLE_NAME">GOOGLE_CLOUD_PROJECT_ID</ProjectId>

Example

The following example configures the policy to use themy_projectid_var flow variable to fetch the project ID, and if the flow variable fails to resolve at runtime, useapigee_staging_1 as the project ID:

<ProjectIdref="my_projectid_var">apigee_staging_1</ProjectId>

The following table describes the attributes of<ProjectId>:

AttributeRequired?TypeDescription
refOptionalStringSpecifies the flow variable from which Apigee should read the Google Cloud Project ID. You can set the<ProjectId> element in one of the following ways:
  • <ProjectId>val</ProjectId>: Useval as the project ID.
  • <ProjectId ref="refval"/>: Resolverefval dynamically to determine the project ID. Apigee reports an exception if the resolved project ID is invalid or ifrefval is unresolved.
  • <ProjectId ref="refval">val</ProjectId>: Resolverefval dynamically to determine the project ID. Apigee reports an exception if the resolved project ID is invalid. Ifrefval does not resolve, useval as the project ID.

<IntegrationName>

Specifies the integration to run.

Apigee assigns the value you specify for this element to theintegration.name flow variable.

The integration name must meet the following naming requirements:

  • Must start and end with letters or numbers.
  • Cannot have spaces.
  • Cannot have two consecutive dash or underscore characters.
Default ValueN/A
Required?Optional
TypeString
Parent Element<SetIntegrationRequest>
Child Elements None

The<IntegrationName> element uses the following syntax:

Syntax

<IntegrationName ref="FLOW_VARIABLE_NAME">INTEGRATION_NAME</IntegrationName>

Example

The following example configures the policy to use themy_integration_ref flow variable to fetch the integration name, and if the flow variable fails to resolve at runtime, useintegration_1 as the integration name:

<IntegrationName ref="my_integration_ref">integration_1</IntegrationName>

The following table describes the attributes of<IntegrationName>:

AttributeRequired?TypeDescription
refOptionalStringSpecifies the flow variable from which Apigee should read the integration name. You can set the<IntegrationName> element in one of the following ways:
  • <IntegrationName>val</IntegrationName>: Useval as the integration name.
  • <IntegrationName ref="refval"/>: Resolverefval dynamically to determine the integration name. Apigee reports an exception if the resolved integration name is invalid or ifrefval is unresolved.
  • <IntegrationName ref="refval">val</IntegrationName>: Resolverefval dynamically to determine the integration name. Apigee reports an exception if the resolved integration name is invalid. Ifrefval does not resolve, useval as the integration name.

<IntegrationRegion>

Specifies the region where integration exists.

At runtime, Apigee assigns the element's value to theintegration.region flow variable, creates a region-based target URL and stores the URL in theintegration.target.url flow variable.

The region-based target URL has the following format:https://integration.region-integrations.googleapis.com

The integration region must be supported by Application Integration. For information about the supported regions of Application Integration, seeSupported regions.

Default ValueN/A
Required?Required
TypeString
Parent Element<SetIntegrationRequest>
Child Elements None

The<IntegrationRegion> element uses the following syntax:

Syntax

<IntegrationRegion ref="FLOW_VARIABLE_NAME">INTEGRATION_REGION</IntegrationRegion>

Example

The following example configures the policy to use themy_integration_region_ref flow variable to fetch the integration region, and if the flow variable fails to resolve at runtime,asia-east1 is used as the region of the integration:

<IntegrationRegionref="my_integration_region_ref">asia-east1</IntegrationRegion>

The following table describes the attributes of<IntegrationRegion>:

AttributeRequired?TypeDescription
refOptionalStringSpecifies the flow variable from which Apigee should read the integration region. You can set the<IntegrationRegion> element in one of the following ways:
  • <IntegrationRegion>val</IntegrationRegion>: Useval as the integration region.
  • <IntegrationRegion ref="refval"/>: Resolverefval dynamically to determine the integration region. Apigee reports an exception if the resolved integration region is invalid or ifrefval is unresolved.
  • <IntegrationRegion ref="refval">val</IntegrationRegion>: Resolverefval dynamically to determine the integration region. Apigee reports an exception if the resolved integration region is invalid. Ifrefval does not resolve, useval as the integration region.

<ApiTrigger>

Specifies the API trigger to run.

You must specify the API trigger name in theapi_trigger/API_TRIGGER_NAME format.

Apigee assigns the value you specify for this element to theintegration.api.trigger flow variable.

If you have specified the<IntegrationName>, only the API trigger of that integration is run. However, if you have not specified the<IntegrationName>, all the integrations that have the specified API trigger are run.

Default ValueN/A
Required?Required
TypeString
Parent Element<SetIntegrationRequest>
Child Elements None

The<ApiTrigger> element uses the following syntax:

Syntax

<ApiTrigger ref="FLOW_VARIABLE_NAME">API_TRIGGER_NAME</ApiTrigger>

Example

The following example configures the policy to use themy_api_trigger_ref flow variable to fetch the API trigger name, and if the flow variable fails to resolve at runtime, useapi_trigger/API-Trigger-2 as the API trigger name:

<ApiTrigger ref="my_api_trigger_ref">api_trigger/API-Trigger-2</ApiTrigger>

The following table describes the attributes of<ApiTrigger>:

AttributeRequired?TypeDescription
refOptionalStringSpecifies the flow variable from which Apigee should read the API trigger name. You can set the<ApiTrigger> element in one of the following ways:
  • <ApiTrigger>val</ApiTrigger>: Useval as the API trigger name.
  • <ApiTrigger ref="refval"/>: Resolverefval dynamically to determine the trigger name. Apigee reports an exception if the resolved API trigger name is invalid or ifrefval is unresolved.
  • <ApiTrigger ref="refval">val</ApiTrigger>: Resolverefval dynamically to determine the trigger name. Apigee reports an exception if the resolved API trigger name is invalid. Ifrefval does not resolve, useval as the trigger name.

<ScheduleTime>

Specifies the time at which the integration must run.

If the time is less or equal to the current time, the integration runs immediately. You must specify the time in theyyyy-mm-ddThh:mm:ssZ format where Z is the UTC timezone. For example, if you specify2022-01-15T01:30:15Z, the integration is scheduled to run on 1-15-2022 at 1:30:15 UTC. You can also specify the timezone using an offset from UTC. For example, if you specify2022-01-15T01:30:15-08:00, the integration is scheduled to run on 1-15-2022 at 1:30:15 PST. For more information about the time format, see Combined date and time representations.

Note: You can schedule the time only if you are running your integrations inasynchronous mode.If you are running your integration in synchronous mode and if you specify a schedule time, the execution of the integration fails and you will get a runtime error.
Default ValueN/A
Required?Optional
TypeString
Parent Element<SetIntegrationRequest>
Child Elements None

The<ScheduleTime> element uses the following syntax:

Syntax

<ScheduleTime>PARAMETER_VALUE</ScheduleTime>

Example

The following example schedules the integration to run at2022-01-15T01:30:15Z:

<ScheduleTime>2022-01-15T01:30:15Z</ScheduleTime>

<Parameters>

Specifies the input parameters required to run the integration.

You can specify individual parameter(s) or parameter array(s).

Default ValueN/A
Required?Optional
TypeComplex type
Parent Element<SetIntegrationRequest>
Child Elements<Parameter>
<ParameterArray>

The following table describes the attributes of<Parameters>:

AttributeRequired?TypeDescription
substitutionVariableCharOptionalCharLets you set custom delimiters to pass flow variable values as template arguments in the<Parameter> child element.Note:substitutionVariableChar can pass template arguments only for parameters of JSON or String datatype, and for parameter arrays of String array datatype.

The<Parameters> element uses the following syntax:

Syntax

<ParameterssubstitutionVariableChar="SUBSTITUTION_CHAR"><Parametername="PARAMETER_NAME"type="PARAMETER_DATATYPE"ref="FLOW_VARIABLE_NAME">PARAMETER_VALUE</Parameter><Parametername="PARAMETER_NAME"type="PARAMETER_DATATYPE">SUBSTITUTION_CHARFLOW_VARIABLE_NAMESUBSTITUTION_CHAR</Parameter><ParameterArrayname="ARRAY_NAME"type="ARRAY_DATATYPE ref="FLOW_VARIABLE_NAME""><Value>PARAMETER_VALUE</Value><Valueref="FLOW_VARIABLE_NAME"/><Valueref="FLOW_VARIABLE_NAME">PARAMETER_VALUE</Value></ParameterArray></Parameters>

Example

The following example initializes themy_str_param parameter and themy_array_param parameter array:

<ParameterssubstitutionVariableChar="#"><Parametername="my_str_param"type="string"ref="flow_var_1">someText</Parameter><Parametername="strVar"type="string">#flowvar1#</Parameter><ParameterArrayname="my_array_param"type="integer"ref="flow_var_2"><Value>1</Value><Valueref="flow_var_3"/><Valueref="flow_var_4">3</Value></ParameterArray></Parameters>

Apigee treats empty<Parameter> and<ParameterArray> elements asnull values. For example, declarations like<Parameter></Parameter> and<ParameterArray></ParameterArray> are treated asnull values.

Note:If a parameter has a JSON value, ensure that the JSON is valid. For example, if your JSON payload contains double quotes ("), escape each double quotes with a backslash (\).

<Parameter>

Specifies an input parameter.

Default ValueN/A
Required?Optional
TypeString
Parent Element<Parameters>
Child Elements None

You can specify the parameter value in the following ways:

The<Parameter> element uses the following syntax:

Syntax
<ParameterssubstitutionVariableChar="SUBSTITUTION_CHAR"><Parametername="PARAMETER_NAME"type="PARAMETER_DATATYPE">PARAMETER_VALUE</Parameter><Parametername="PARAMETER_NAME"type="PARAMETER_DATATYPE"ref="FLOW_VARIABLE_NAME"/><Parametername="PARAMETER_NAME"type="PARAMETER_DATATYPE"ref="FLOW_VARIABLE_NAME">PARAMETER_VALUE</Parameter><Parametername="PARAMETER_NAME"type="json">$#FLOW_VARIABLE_NAME#$</Parameter><Parametername="PARAMETER_NAME"type="PARAMETER_DATATYPE">SUBSTITUTION_CHARFLOW_VARIABLE_NAMESUBSTITUTION_CHAR</Parameter></Parameters>
Example 1

The following example declaresmy_str_param parameter as a string and sets the value tosomeText.

<Parameters><Parametername="my_str_param"type="string">someText</Parameter></Parameters>
Example 2

The following example declaresmy_double_param parameter as a double and assigns the value of theflow_var flow variable to the parameter.

<Parameters><Parametername="my_double_param"type="double"ref="flow_var"/></Parameters>
Example 3

The following example sets value to themy_int_param_1 integer parameter.

<Parameters><Parametername="my_int_param_1"type="integer"ref="flow_var_1">96</Parameter></Parameters>

In this example, if theflow_var_1 flow variable resolves successfully,my_int_param_1 is set to the value of the flow variable. However, ifflow_var_1 fails to resolve,my_int_param_1 is set to96.

Example 4

The following example sets values for themy_json_param_1 andmy_json_param_2 JSON parameters.

<Parameters><Parametername="my_json_param_1"type="json"ref="flow_var_1">{name:"Apple",color:"Red"}</Parameter><Parametername="my_json_param_2"type="json">{name:"Banana",color:"Yellow"}</Parameter></Parameters>

In this example, if theflow_var_1 flow variable resolves successfully,my_json_param_1 is set to the value of theflow_var_1 flow variable. However, if theflow_var_1 fails to resolve,my_json_param_1 is set to{name:"Apple", color:"Red"}. Themy_json_param_2 parameter is set to{name:"Banana", color:"Yellow"} as there is noref attribute specified.

Example 5

The following example sets the value for thetemplate_json_param JSON parameter using the flow variable value passed in the default template.

<Parameters><Parametername="template_json_param"type="json">{"name":"$#flow_var_1#$"}</Parameter></Parameters>

In this example, if theflow_var_1 flow variable resolves successfully,template_json_param is set to the value of theflow_var_1 flow variable. However, if theflow_var_1 fails to resolve, Apigee throws an exception.

Example 6

The following example sets the value for thetemplate_json_param JSON parameter using thesubstitutionVariableChar attribute.

<ParameterssubstitutionVariableChar="#"><Parametername="template_json_param"type="json">{"name":"#flow_var_1#"}</Parameter></Parameters>

In this example, if theflow_var_1 flow variable resolves successfully,template_json_param is set to the value of theflow_var_1 flow variable. However, if theflow_var_1 fails to resolve, Apigee throws an exception.

The following table describes the attributes of<Parameter>:

AttributeRequired?TypeDescription
nameRequiredStringName of the parameter.
typeRequiredStringData type of the parameter. The supported types areinteger,string,boolean,double, andjson.
refOptionalStringSpecifies the flow variable from which Apigee should read the parameter value. Apigee uses the following criteria to set the parameter value:
  • If the flow variable resolves at runtime and is valid, Apigee uses the value of the flow variable.
  • If the flow variable resolves at runtime but is invalid, Apigee reports an exception.
  • If the flow variable doesn't resolve at runtime, Apigee uses the<Parameter> element value. If the element value is invalid, Apigee reports an error.

<ParameterArray>

Specifies an input parameter array.

Default ValueN/A
Required?Optional
TypeComplex type
Parent Element<Parameters>
Child Elements<Value>

The<Parameters> element can have multiple<ParameterArray> elements within it. For a parameter array you can set the value of the array elements either by specifying the actual value or by specifying a flow variable in theref attribute. If you specify a flow variable, the array elements are set to the value of the flow variable. The examples in this section describe the various ways in which you can configure the<ParameterArray> element.

The<ParameterArray> element uses the following syntax:

Syntax
<Parameters><ParameterArrayname="ARRAY_NAME"type="ARRAY_DATATYPE"ref="FLOW_VARIABLE_NAME"><Valueref="FLOW_VARIABLE_NAME"/><Valueref="FLOW_VARIABLE_NAME">PARAMETER_VALUE</Value><Value>PARAMETER_VALUE</Value></ParameterArray><ParameterArrayname="ARRAY_NAME"type="ARRAY_DATATYPE"ref="FLOW_VARIABLE_NAME"/><ParameterArrayname="ARRAY_NAME"type="ARRAY_DATATYPE"><Valueref="FLOW_VARIABLE_NAME"/><Valueref="FLOW_VARIABLE_NAME">PARAMETER_VALUE</Value><Value>PARAMETER_VALUE</Value></ParameterArray><Parameters/>
Example-1

The following example declaresmy_array_param as an integer array and sets the value of the array elements to1,2, and3:

<Parameters><ParameterArrayname="my_array_param"type="integer"><Value>1</Value><Value>2</Value><Value>3</Value></ParameterArray><Parameters/>
Example-2

The following example declaresmy_array_param as a double array where:

  • First element is set to the value of theflow_var_1 flow variable.
  • Second element is set to3.0.
<Parameters><ParameterArrayname="my_array_param"type="double"><Valueref="flow_var_1"/><Value>3.0</Value></ParameterArray><Parameters/>
Example-3

The following example declaresmy_array_param as a boolean array and sets it to the value of theflow_var_1 flow variable.

<Parameters><ParameterArrayname="my_array_param"type="boolean"ref="flow_var_1"><Value>true</Value><Value>false</Value><Value>false</Value></ParameterArray><Parameters/>

In this example, ifflow_var_1 resolves successfully,my_array_param is set to the values of theflow_var_1 array. However, ifflow_var_1 fails to resolve, themy_array_param array is set to the values of theValue elements.

Example-4

The following example declaresmy_array_param as a JSON array and sets it to the value of theflow_var_1 flow variable.

<Parameters><ParameterArrayname="my_array_param"type="json"ref="flow_var_1"/><Parameters/>

In this example, ifflow_var_1 resolves successfully,my_array_param is set to the values of theflow_var_1 array. However, ifflow_var_1 fails to resolve, Apigee reports an exception.

Example-5

The following example declaresmy_array_param as a string array and sets it to the values of theflow_var_1 flow variable.

<Parameters><ParameterArrayname="my_array_param"type="string"ref="flow_var_1"><Valueref="flow_var_2"/><Value>test_string</Value></ParameterArray><Parameters/>

In this example, ifflow_var_1 resolves successfully,my_array_param is set to the values of theflow_var_1 array. Only ifflow_var_1 fails to resolve,my_array_param is set to the values specified in the<Value> elements.

The following table describes the attributes of<ParameterArray>:

AttributeRequired?TypeDescription
nameRequiredStringName of the parameter array.
typeRequiredStringData type of the parameter array. The supported types areinteger,string,boolean, anddouble.
refOptionalStringSpecifies the flow variable from which Apigee should read the array values. Apigee uses the following criteria to set the parameter value:
  • If the flow variable resolves at runtime and is valid, Apigee uses the value of the flow variable.
  • If the flow variable resolves at runtime but is invalid, Apigee reports an exception.
  • If the flow variable doesn't resolve at runtime, Apigee uses the values specified in the<Value> elements.
<Value>

Specifies the value of an array element.

Default ValueN/A
Required?Optional
TypeString
Parent Element<ParameterArray>
Child Elements None

Each element of the array must be a separate<Value> element. You can specify the value in the following ways:

  • <Value>val</Value>: Useval as the element value. Ifval is invalid, Apigee reports an exception.
  • <Value ref="refval"/>: Resolve therefval flow variable at runtime and use its value. Apigee reports an exception if the resolvedrefval value is invalid or ifrefval is unresolved.
  • <Value ref="refval">val</Value>: Resolve therefval flow variable at runtime and use its value. Apigee reports an exception if the resolvedrefval value is invalid. Ifrefval does not resolve, Apigee usesval as the element value.
  • <Value>val1 $#flowval#$</Value>: Use$#FLOW_VARIABLE_NAME#$ to pass flow variable values as a template argument in Value. Apigee resolves theflowval flow variable at runtime and uses its value. An exception is reported if the resolvedflowval value is invalid.Note:You can only specify template arguments as Value for parameter arrays of string data type.Warning: Template arguments enclosed within{ and} are no longer identified as flow variables.

The<Value> element uses the following syntax:

Syntax
<ParameterArrayname="ARRAY_NAME"type="ARRAY_DATATYPE"ref="FLOW_VARIABLE_NAME"><Value>PARAMETER_VALUE</Value><Valueref="FLOW_VARIABLE_NAME"/><Valueref="FLOW_VARIABLE_NAME">PARAMETER_VALUE</Value></ParameterArray>
Example 1

The following example declaresmy_array_param as an integer parameter array with values1,2, and3:

<ParameterArrayname="my_array_param"type="integer"><Value>1</Value><Value>2</Value><Value>3</Value></ParameterArray>
Example 2

The following example declaresmy_array_param as a string parameter array with values of theflow_var_1 andflow_var_2 flow variables:

<ParameterArrayname="my_array_param"type="string"><Valueref="flow_var_1"/><Valueref="flow_var_2"/></ParameterArray>
Example 3

The following example declaresmy_array_param as a string parameter array:

<ParameterArrayname="my_array_param"type="string"><Valueref="flow_var_1">string_1</Value><Valueref="flow_var_2">string_2</Value></ParameterArray>

In this example, if the flow variable resolves successfully, the array element value is set to the value of theflow_var_1 flow variable. However, ifflow_var_1 fails to resolve, the array element value is set tostring_1.

Example 4

The following example sets the value for thetemplate_strArray_param string array parameter using the flow variable value passed in a template.

<Parameters><ParameterArrayname="template_strArray_param"type="string"><Value>apple$#flow_var_1#$</Value></ParameterArray></Parameters>

In this example, if the flow variable resolves successfully, the array element value is set to the value of theflow_var_1 flow variable. However, ifflow_var_1 fails to resolve, Apigee throws an exception.

The following table describes the attributes of<Value>:

AttributeRequired?TypeDescription
refOptionalStringSpecifies the flow variable from which Apigee should read the parameter value. Apigee uses the following criteria to set the parameter value:
  • If the flow variable resolves at runtime and is valid, Apigee uses the value of the flow variable.
  • If the flow variable resolves at runtime but is invalid, Apigee reports an exception.
  • If the flow variable doesn't resolve at runtime, Apigee uses the<Value> element's value. If the element value is invalid, Apigee reports an error.
Note: The<Value> element can't be empty.

<Request>

Specifies the flow variable name for saving the request.

Note: If you are using an integration endpoint instead of theIntegrationCallout policy policy, do not specify the<Request> element in the SetIntegrationRequest policy.

After the policy executes, it creates a newrequest message object, and saves the object in theFLOW_VARIABLE_NAME variable which you can query to read the request.

If you do not specify a flow variable name, the policy saves the request in therequest message, overriding the existing request message if any.

Default Valuerequest
Required?Optional
TypeString
Parent Element<SetIntegrationRequest>
Child Elements None

The<Request> element uses the following syntax:

Syntax

<Request>FLOW_VARIABLE_NAME</Request>

Example

The following example saves the request object in themy_request_var flow variable:

<Request>my_request_var</Request>

Error codes

This section describes the fault codes, error messages, and the fault variables set by Apigee when this policy triggers an error. This information is essential if you are developing fault rules to handle faults. To learn more, seeWhat you need to know about policy errors andHandling faults.

Runtime errors

These errors can occur when the policy executes.

Fault codeHTTP statusCause
steps.setintegrationrequest.EmptyParameterArray500

This error occurs when the<ParameterArray> element has thename andtype attributes, but doesn't have theref attribute or a<Value> element.

steps.setintegrationrequest.EmptyParameterArrayValue500

This error occurs when the<Value> element is empty and theref attribute is not set.

steps.setintegrationrequest.InvalidResolvedFlowVariable500

This error occurs when the flow variable specified in theref attribute of an element fails to resolve to a valid value.

  • For theProjectId,IntegrationName, or theApiTrigger elements, this error occurs if the flow variable resolves to a null, an empty string, or an invalid data type.

    A valid value for these elements is as follows:

    • ProjectId: See the naming requirements forProject ID in theBefore you begin section.
    • IntegrationName: See the naming requirements for theIntegrationName element.
    • ApiTrigger: The name should start withapi_trigger/.
  • For theParameterArray element, this error occurs if the flow variable resolves to an empty string.
steps.setintegrationrequest.MismatchedTypeAndResolvedRef500

This error occurs when the flow variable specified intheref attribute of the<Parameter> element resolves, but the flow variable value's data type doesn't match the data type specified in thetype attribute.

steps.setintegrationrequest.MismatchedTypeAndResolvedRefOfParameterArray500

This error occurs when the flow variable specified intheref attribute of the<ParameterArray> element resolves, but the flow variable value's data type doesn't match with the data type specified in thetype attribute.

steps.setintegrationrequest.MismatchedTypeAndResolvedRefOfParameterArrayValue500

This error occurs when the flow variable specified intheref attribute of the<Value> element resolves, but the flow variable value's data type doesn't match with the data type specified in thetype attribute of its parent element (<ParameterArray>).

steps.setintegrationrequest.RequestVariableNotMessageType500This error occurs when the flow variable specified by theRequest element is not ofmessage type.
steps.setintegrationrequest.RequestVariableNotRequestMessageType500This error occurs when the flow variable specified by theRequest element is not ofRequest message type.
steps.setintegrationrequest.UnresolvedVariable500

This error occurs when Apigee can't resolve the flow variables specified in the<Parameter>,<ParameterArray>, or the<Value> elements.

Fault variables

Whenever there are execution errors in a policy, Apigee generates error messages. You can view these error messages in the error response. Many a time, system generated error messages might not be relevant in the context of your product. You might want to customize the error messages based on the type of error to make the messages more meaningful.

To customize the error messages, you can use either fault rules or the RaiseFault policy. For information about differences between fault rules and the RaiseFault policy, seeFaultRules vs. the RaiseFault policy. You must check for conditions using theCondition element in both the fault rules and the RaiseFault policy. Apigee provides fault variables unique to each policy and the values of the fault variables are set when a policy triggers runtime errors. By using these variables, you can check for specific error conditions and take appropriate actions. For more information about checking error conditions, seeBuilding conditions.

The following table describes the fault variables specific to this policy.

VariablesWhereExample
fault.nameThefault.name can match to any of the faults listed in theRuntime errors table. The fault name is the last part of the fault code.fault.name Matches "UnresolvedVariable"
SetIntegrationRequest.POLICY_NAME.failedPOLICY_NAME is the user-specified name of the policy that threw the fault.SetIntegrationRequest.set-integration-request-1.failed = true
For more information about policy errors, seeWhat you need to know about policy errors.

Related topics

If you want to learn more about Application Integration feature, seeApplication Integration overview

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-12-17 UTC.