Saat menyiapkan Integrasi Aplikasi di project Google Cloud Anda untuk pertama kalinya, Integrasi Aplikasi akan membuat integrasi contoh yang tidak dipublikasikan secara default, yang bernama ExampleIntegration-EcomOrderProcessing.
Melihat contoh integrasi
Untuk melihat contoh integrasi, lakukan hal berikut:
Di konsol Google Cloud, buka halaman Integrasi Aplikasi.
Mengekstrak variabel input JSON order_request dan melakukan iterasi pada semua item pesanan menggunakan fungsi pemetaan FOR_EACH untuk menghitung total nilai harga pesanan.
Nilai harga pesanan total dihitung dengan mengalikan item quantity dan price_per_item menggunakan fungsi pemetaan GET_PROPERTY dan MULTIPLY.
Nilai akhir kemudian dikonversi ke jenis data ganda dan disimpan dalam variabel output total_order_value.
Untuk tujuan menguji integrasi contoh ini, Anda dapat menggunakan email untuk mengonfirmasi bahwa integrasi berhasil diselesaikan.
Mengirim email permintaan persetujuan ke satu atau beberapa pengguna integrasi. Email tersebut menyertakan link ke integrasi tempat pengguna dapat menyetujui atau menolak permintaan secara manual.
Daftar yang akan di-iterasi:filtered_external_items
ID Pemicu API:api_trigger/ecom-order-processing_API_2
Nama integrasi: ExampleIntegration-EcomOrderProcessing
Melakukan iterasi pada variabel filtered_external_items dan memanggil sub-integrasi untuk setiap elemen dalam array. Fungsi ini juga mengumpulkan respons dari setiap operasi di rest_call_response_status, dengan setiap elemen array memiliki respons dari satu operasi tertentu.
URL dasar endpoint: https://mocktarget.apigee.net/echo
Metode HTTP:POST
Isi permintaan: sub_integration_input
Melakukan panggilan REST ke https://mocktarget.apigee.net/echo.
Memublikasikan dan menguji integrasi contoh
Untuk memublikasikan integrasi, klik Publikasikan di toolbar editor integrasi.
Setelah berhasil memublikasikan integrasi, Anda dapat melihat dan memeriksa log eksekusi integrasi yang dipublikasikan. Untuk melihat log, klik Lihat log eksekusi untuk integrasi ini. Halaman Execution Logs akan muncul.
Menguji dari editor integrasi
Lakukan hal berikut untuk menguji integrasi contoh:
Klik Test di toolbar editor integrasi, lalu pilih OrderProcessAPITrigger.
Panel Uji Integrasi akan muncul.
Anda akan diminta untuk mengedit variabel input orders_request. Untuk tujuan pengujian ini, Anda dapat memperbarui nilai quantity menjadi 240. Variabel input orders_request update akan terlihat seperti berikut:
Karena jumlah orders_request yang diperbarui lebih besar dari 200, integrasi contoh akan mengirim email permintaan persetujuan ke alamat email yang ditentukan di kolom Penerima pada Tugas persetujuan. Operasi pesanan integrasi akan berhasil diselesaikan setelah persetujuan diterima.
Lakukan hal berikut untuk memeriksa log eksekusi dan melihat status serta payload integrasi tertentu:
Di editor integrasi, klik Lihat log eksekusi untuk integrasi ini. Halaman Execution Logs akan muncul.
Di halaman Log Eksekusi, Anda dapat melihat detail tentang setiap upaya untuk menjalankan integrasi.
Setiap entri menyertakan detail untuk upaya eksekusi, termasuk:
Nama integrasi
ID eksekusi
Status
Waktu mulai
Durasi
Versi Integrasi
ID Pemicu
Klik panah peluas (>) di samping integrasi yang dieksekusi untuk melihat daftar tugas dan variabel yang diperluas dalam integrasi, beserta status tugas dan payload variabel.
Menguji menggunakan panggilan REST API
Kasus pengujian 1: Mengirim permintaan dengan input default
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-03 UTC."],[[["\u003cp\u003eApplication Integration provides a default, unpublished sample integration called \u003cstrong\u003eExampleIntegration-EcomOrderProcessing\u003c/strong\u003e to help users understand its triggers, tasks, and concepts.\u003c/p\u003e\n"],["\u003cp\u003eThe sample integration simulates an e-commerce order processing scenario, including receiving order requests, calculating total order value, checking for value thresholds, and handling external vendor items.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003cstrong\u003eExampleIntegration-EcomOrderProcessing\u003c/strong\u003e utilizes various components, such as an API trigger, data mapping tasks, edge conditions, an approval task, and a for-each loop task, all detailed in the included documentation.\u003c/p\u003e\n"],["\u003cp\u003eUsers can test the sample integration directly from the integration editor by modifying the \u003ccode\u003eorders_request\u003c/code\u003e input variable or by sending requests using a REST API call with custom parameters.\u003c/p\u003e\n"],["\u003cp\u003eExecution logs for the sample integration can be viewed to monitor the status of each run, including details on the various tasks, variables, and payloads.\u003c/p\u003e\n"]]],[],null,["# Try the sample integration\n\nSee the [supported connectors](/integration-connectors/docs/connector-reference-overview) for Application Integration.\n\nTry the sample integration\n==========================\n\n\nWhile 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**.\n\nView sample integration\n-----------------------\n\n\nTo view the sample integtration, do the following:\n\n1. In the Google Cloud console, go to the **Application Integration** page.\n\n [Go to Application Integration](https://console.cloud.google.com/integrations)\n2. Click **Integrations** from the left navigation menu to open the **Integrations** page.\n3. Click the integration named **ExampleIntegration-EcomOrderProcessing** .\n\n\n The sample integration opens in the [integration editor](/application-integration/docs/integrations-ui-layout) similar to the following layout:\n\n\n| **Tip:** If you are unable to find or open the sample integration, you can download the JSON version of the integration and upload it back using the integration editor. For more information, see [E-commerce sample integration](/application-integration/docs/samples/ecom-order-processing).\n\nE-commerce sample integration\n-----------------------------\n\n\nYou can use this sample integration to get a hands-on experience of the various [triggers](/application-integration/docs/triggers), [tasks](/application-integration/docs/tasks), and [concepts](/application-integration/docs/concepts) of Application Integration.\n\n\nThe sample integration illustrates a basic e-commerce back-end scenario implementing the following order processing operation:\n\n1. Receive the following order request payload from an API endpoint: \n\n ```json\n {\n \"order_no\": \"12345\",\n \"buyer_id\": \"raambo\",\n \"line_items\": [\n {\n \"line\": 1,\n \"sku\": \"tr100\",\n \"vendor\": \"Internal\",\n \"quantity\": 1,\n \"price_per_unit\": 10\n },\n {\n \"line\": 2,\n \"sku\": \"tbz\",\n \"vendor\": \"External\",\n \"quantity\": 24.0,\n \"price_per_unit\": 1\n }\n ]\n }\n ```\n2. Extract the order payload and calculate the total order value.\n3. Check if the total order value is greater than or equal to $100. If yes, then get an additional approval to continue.\n4. 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.\n5. Send out the order response with the total order value, filtered external vendor items and their respective HTTP response status.\n\n\nThe following table lists all the triggers, tasks, and edge conditions used in **ExampleIntegration-EcomOrderProcessing**:\n\nPublish and test the sample integration\n---------------------------------------\n\nTo publish the integration click **Publish** in the integration editor toolbar.\n\nUpon successfully publishing your integration, you can view and inspect the [execution logs](/application-integration/docs/integration-execution-logs) of the published integration. To view logs, click **View execution logs for this integration** . The **Execution Logs** page appears.\n\n### Test from the integration editor\n\nDo the following to test the sample integration:\n\n1. Click **Test** in the integration editor toolbar, and then select **OrderProcessAPITrigger** .\n\n The **Test Integration** pane appears.\n2. You are prompted to edit the `orders_request` input variable. For the purpose of this test, you can update the `quantity` value to `240`. The update `orders_request` input variable should look similar to the following: \n\n ```json\n {\n \"order_no\": \"12345\",\n \"buyer_id\": \"raambo\",\n \"line_items\": [\n {\n \"line\": 1,\n \"sku\": \"tr100\",\n \"vendor\": \"Internal\",\n \"quantity\": 1,\n \"price_per_unit\": 10\n },\n {\n \"line\": 2,\n \"sku\": \"tbz\",\n \"vendor\": \"External\",\n \"quantity\": 240,\n \"price_per_unit\": 1\n }\n ]\n }\n \n ```\n3. Click **Test integration**.\n\n\nSince 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](#approval). The integration order operation will successfully complete once the approval is received.\n\nFor more information about testing, see [Test and publish integrations](/application-integration/docs/test-publish-integrations).\n\nDo the following to inspect the execution logs and to view the status\nand payload of the given integration:\n\n1. In the integration editor, click **View execution logs for this integration** . The **Execution Logs** page appears.\n2. 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:\n - Integration name\n - Execution ID\n - Status\n - Start time\n - Duration\n - Integration Version\n - Trigger ID\n3. Click the expander arrow (**\\\u003e**) next to the executed integration to view an expanded list of tasks and variables in the integration, along with task status and variable payloads.\n\n### Test using a REST API call\n\n| **Note:** The following test cases use `curl`, which typically comes pre-installed for Linux and macOS operating systems. If you don't have `curl`, you can download it from the `curl` [releases and downloads page](https://curl.haxx.se/download.html).\n\n#### Test case 1: Send request with default inputs\n\n```\n 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)\"\n```\n\n#### Test case 2: Send request with custom inputs\n\n```\n 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)\"\n```\n\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e: The ID of your Google Cloud project.\n- \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e: The integration location. See [Application Integration locations](/application-integration/docs/locations).\n- \u003cvar translate=\"no\"\u003eINTEGRATION_NAME\u003c/var\u003e: Name of the integration.\n\n#### Test output\n\n\nThe API returns the integration execution response containing all the integration output variable values.\n\nQuotas and limits\n-----------------\n\nFor information about quotas and limits, see [Quotas and limits](/application-integration/docs/quotas)."]]