Enable to pass json payload from apigee to app integration flow

np1
Bronze 3
Bronze 3

In Apigee i am trying to send json payload to app integration through POST request using below curl command but not able to pass payload to app integration.

curl command:

curl -X POST -d “{"employee_id":”1”,"employee_first_name":"Megha","employee_last_name":"Bhat","employee_emailID":"test-01@test.com"}”  -k https://hostname/test

Apigee policies to fetch payload and send to app integration:

1. Extract Policy:  

np1_0-1711106089712.png

2. Set-integration policy: 

np1_1-1711106177782.png

Can anyone suggest here.

Solved Solved
2 5 195
1 ACCEPTED SOLUTION

In your SetIntegrationRequest policy, you need to explicitly set this field:

<Request>OrderIntegrationRequest</Request>

Then you need to execute an IntegrationCallout policy. Here's an example:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntegrationCallout continueOnError="false" enabled="true" name="IntegrationCalloutInsert">
  <DisplayName>IntegrationCallout.Insert</DisplayName>
  <AsyncExecution>false</AsyncExecution>
  <Request clearPayload="true">OrderIntegrationRequest</Request>
  <Response>processorder_integration_response</Response>
</IntegrationCallout>

View solution in original post

5 REPLIES 5

In your SetIntegrationRequest policy, you need to explicitly set this field:

<Request>OrderIntegrationRequest</Request>

Then you need to execute an IntegrationCallout policy. Here's an example:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntegrationCallout continueOnError="false" enabled="true" name="IntegrationCalloutInsert">
  <DisplayName>IntegrationCallout.Insert</DisplayName>
  <AsyncExecution>false</AsyncExecution>
  <Request clearPayload="true">OrderIntegrationRequest</Request>
  <Response>processorder_integration_response</Response>
</IntegrationCallout>

To give more context 

The IntegrationCallout policy lets you run an Apigee integration that has an API trigger. However, before running an integration, you must run the SetIntegrationRequest policy. The SetIntegrationRequest policy creates a request object and makes the object available to the IntegrationCallout policy as a flow variable. The request object has the integration details such as the API trigger name, integration project ID, integration name, and other details configured in the SetIntegrationRequest policy. The IntegrationCallout policy uses the flow variable of the request object to run the integration. You can configure the IntegrationCallout policy to save the integration run response in a flow variable.

The IntegrationCallout policy is helpful if you want to run integration in the middle of your proxy flow. Alternately, instead of configuring the IntegrationCallout policy, you can also run an integration by specifying an integration endpoint as your target endpoint. For more information, see IntegrationEndpoint.

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.

np1
Bronze 3
Bronze 3

Hi All,

I am now able to pass payload to application integration from apigee and integration flow is also successful but same response is not coming to apigee, getting error:

np1_0-1711962751726.pngnp1_1-1711962785913.png

In Application Integration, can you confirm you are setting the integration result as an Output variable? You can check the Variables pan inside the integration and see it listed under Outputs if so

See https://cloud.google.com/application-integration/docs/variables#integration_var for more information.

Further, you must also set the response element in the IntegrationCallout policy in your Apigee proxy.

See https://cloud.google.com/apigee/docs/api-platform/reference/policies/integration-callout-policy#resp...

Then you can reference JSON elements inside of the response variable as necessary.

 

I have already set my policies as below to get integration response,

SetIntegration Policy:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<SetIntegrationRequest continueOnError="false" enabled="true" name="SIR-GetCall">
    <DisplayName>SIR-GetCall</DisplayName>
    <ProjectId>test-apigee</ProjectId>
    <IntegrationName>CopyBenchmark</IntegrationName>
    <IntegrationRegion>europe-west2</IntegrationRegion>
    <Request clearPayload="true">OrderIntegrationRequest</Request>
    <ApiTrigger>api_trigger/CopyBenchmark1</ApiTrigger>
    <Parameters>
        <Parameter name="entityId" type="string" ref="queryinfo.entityId"/>
    </Parameters>
</SetIntegrationRequest>

IntegrationCallout Policy:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<IntegrationCallout continueOnError="false" enabled="true" name="IntegrationCalloutInsert">
    <DisplayName>IntegrationCallout.Insert</DisplayName>
    <AsyncExecution>false</AsyncExecution>
    <Request clearPayload="true">OrderIntegrationRequest</Request>
    <Response>output</Response> <!-- Integration output variable "output" -->
</IntegrationCallout>

But it is giving empty response with 200 OK.