Try the sample integration
While setting up Application Integration in your Google Cloud project for the first time, Application Integration, by default, creates an unpublished sample integration named ExampleIntegration-EcomOrderProcessing .
View sample integration
To view the sample integtration, do the following:
- In the Google Cloud console, go to the Application Integration page.
- Click Integrations from the left navigation menu to open the Integrations page.
- Click the integration named ExampleIntegration-EcomOrderProcessing 
. The sample integration opens in the integration editor similar to the following layout:    
E-commerce sample integration
You can use this sample integration to get a hands-on experience of the various triggers , tasks , and concepts of Application Integration.
The sample integration illustrates a basic e-commerce back-end scenario implementing the following order processing operation:
- Receive the following order request payload from an API endpoint: { "order_no" : "12345" , "buyer_id" : "raambo" , "line_items" : [ { "line" : 1 , "sku" : "tr100" , "vendor" : "Internal" , "quantity" : 1 , "price_per_unit" : 10 }, { "line" : 2 , "sku" : "tbz" , "vendor" : "External" , "quantity" : 24.0 , "price_per_unit" : 1 } ] } 
- Extract the order payload and calculate the total order value.
- Check if the total order value is greater than or equal to $100. If yes, then get an additional approval to continue.
- Check if any of the order items have an external vendor. If yes, then send the details to the vendor using a REST API call.
- Send out the order response with the total order value, filtered external vendor items and their respective HTTP response status.
The following table lists all the triggers, tasks, and edge conditions used in ExampleIntegration-EcomOrderProcessing :
(OrderProcessAPITrigger)
api_trigger/ecom-order-processing_API_1 
(Find Total Order Price)
order_request 
JSON input variable and iterates through all the order items using the FOR_EACH 
mapping function to calculate the total order price value. The total order price value is calculated by multiplying the item quantity 
and the price_per_item 
using the GET_PROPERTY 
and MULTIPLY 
mapping functions.
The final value is then converted to a double data type and stored in the total_order_value 
output variable.
orders_reques t .li ne _i te ms .FOR_EACH(~obj 1- >~obj 1 .GET_PROPERTY( "quantity" ) .TO_DOUBLE() .MULTIPLY(~obj 1 .GET_PROPERTY( "price_per_unit" ) .TO_DOUBLE())) .TO_DOUBLE_ARRAY() .SUM()
total_order_value 
(Total OrderValue Above Threshold)
$total_order_value$ >= $threshold_order_value$ 
(TotalOrderValue Below Threshold)
$total_order_value$ < $threshold_order_value$ 
(Approval)
For the purpose of testing this sample integration, you can use your email to confirm the successful completion of the integration.
(Filter External Items)
order_request 
JSON input variable and filters all the order items with external vendors using the FILTER 
mapping function. The filtered values are then stored in the filtered_external_items 
output variable.
orders_reques t .GET_PROPERTY( "line_items" ) .FILTER(~obj 1- >~obj 1 .GET_PROPERTY( "vendor" ) .TO_STRING() .EQUALS( "External" ))
filtered_external_items 
(For Each Loop)
filtered_external_items 
  API Trigger ID: api_trigger/ecom-order-processing_API_2 
 Integration name: ExampleIntegration-EcomOrderProcessing 
filtered_external_items 
variable and calls the sub-integration for each element in the array. It also collates the response of each run in rest_call_response_status 
, where each element of the array has the response from one particular run.(Report ExternalOrders)
api_trigger/ecom-order-processing_API_2 
(Call REST Endpoint)
https://mocktarget.apigee.net/echo 
  HTTP method: 
 POST 
 Request body: sub_integration_input 
Publish and test the sample integration
To publish the integration click Publish in the integration editor toolbar.
Upon successfully publishing your integration, you can view and inspect the execution logs 
of the published integration. To view logs, click  View execution logs for this integration 
. The Execution Logs 
page appears.
View execution logs for this integration 
. The Execution Logs 
page appears.
Test from the integration editor
Do the following to test the sample integration:
- Click Test 
in the integration editor toolbar, and then select OrderProcessAPITrigger 
. The Test Integration pane appears. 
- You are prompted to edit the orders_requestinput variable. For the purpose of this test, you can update thequantityvalue to240. The updateorders_requestinput variable should look similar to the following:{ "order_no" : "12345" , "buyer_id" : "raambo" , "line_items" : [ { "line" : 1 , "sku" : "tr100" , "vendor" : "Internal" , "quantity" : 1 , "price_per_unit" : 10 }, { "line" : 2 , "sku" : "tbz" , "vendor" : "External" , "quantity" : 240 , "price_per_unit" : 1 } ] } 
- Click Test integration .
Since the updated orders_request 
quantity is greater than 200 
, the sample integration sends an approval request email to the email address specified in the Recipients 
field of the Approval task 
. The integration order operation will successfully complete once the approval is received.
For more information about testing, see Test and publish integrations .
Do the following to inspect the execution logs and to view the status and payload of the given integration:
- In the integration editor, click  View execution logs for this integration 
. The Execution Logs 
page appears. View execution logs for this integration 
. The Execution Logs 
page appears.
- On the Execution Logs 
page, you can view details about each attempt to run an integration.
    Each entry includes details for the execution attempt, including: - Integration name
- Execution ID
- Status
- Start time
- Duration
- Integration Version
- Trigger ID
 
- Click the expander arrow ( > ) next to the executed integration to view an expanded list of tasks and variables in the integration, along with task status and variable payloads.
Test using a REST API call
Test case 1: Send request with default inputs
curl -X POST -H "Content-Type: application/json" -d '{"trigger_id":"api_trigger/ecom-order-processing_API_1"}' 'https://integrations.googleapis.com/v1/projects/ PROJECT_ID /locations/ LOCATION /integrations/ INTEGRATION_NAME :execute' -H "Authorization: Bearer $(gcloud auth print-access-token)"
Test case 2: Send request with custom inputs
curl -X POST -H "Content-Type: application/json" -d '{ "triggerId": "api_trigger/ecom-order-processing_API_1", "inputParameters": { "orders_request": { "jsonValue": "{\n \"order_no\": \"12345\",\n \"buyer_id\": \"raambo\",\n \"line_items\": [{\n \"line\": 1.0,\n \"sku\": \"tr100\",\n \"vendor\": \"Internal\",\n \"quantity\": 1.0,\n \"price_per_unit\": 10.0\n }, {\n \"line\": 2.0,\n \"sku\": \"tbz\",\n \"vendor\": \"External\",\n \"quantity\": 24.0,\n \"price_per_unit\": 2.0\n }]\n}" } } }' 'https://integrations.googleapis.com/v1/projects/ PROJECT_ID /locations/ LOCATION /integrations/ INTEGRATION_NAME :execute' -H "Authorization: Bearer $(gcloud auth print-access-token)"
Replace the following:
- PROJECT_ID : The ID of your Google Cloud project.
- LOCATION : The integration location. See Application Integration locations .
- INTEGRATION_NAME : Name of the integration.
Test output
The API returns the integration execution response containing all the integration output variable values.
Quotas and limits
For information about quotas and limits, see Quotas and limits .

