Lorsque vous configurez Application Integration pour la première fois dans votre projet Google Cloud, il crée par défaut un exemple d'intégration non publié nommé ExampleIntegration-EcomOrderProcessing.
Afficher un exemple d'intégration
Pour afficher l'exemple d'intégration, procédez comme suit:
Dans la console Google Cloud, accédez à la page Application Integration.
Extrayez la charge utile de la commande et calculez la valeur totale de la commande.
Vérifiez si la valeur totale de la commande est supérieure ou égale à 100 $. Si c'est le cas, obtenez une approbation supplémentaire pour continuer.
Vérifiez si l'un des articles de la commande est fourni par un fournisseur externe. Si c'est le cas, envoyez les informations au fournisseur à l'aide d'un appel d'API REST.
Envoyez la réponse de commande avec la valeur totale de la commande, les articles du fournisseur externe filtrés et leur état de réponse HTTP respectif.
Le tableau suivant liste tous les déclencheurs, tâches et conditions de bord utilisés dans ExampleIntegration-EcomOrderProcessing:
Extraction de la variable d'entrée JSON order_request et itération sur tous les articles de la commande à l'aide de la fonction de mappage FOR_EACH pour calculer la valeur du prix total de la commande.
La valeur du prix total de la commande est calculée en multipliant l'quantity de l'article et le price_per_item à l'aide des fonctions de mappage GET_PROPERTY et MULTIPLY.
La valeur finale est ensuite convertie en type de données double et stockée dans la variable de sortie total_order_value.
Vérifie si la valeur totale de la commande est inférieure à 100 $. Si la réponse est oui, le contrôle est transmis à la tâche Filtrer les éléments externes.
Pour tester cet exemple d'intégration, vous pouvez utiliser votre adresse e-mail pour confirmer que l'intégration a bien été effectuée.
Envoyez un e-mail de demande d'approbation à un ou plusieurs utilisateurs d'intégration. L'e-mail inclut un lien vers l'intégration où les utilisateurs peuvent approuver ou rejeter manuellement la demande.
Extraction de la variable d'entrée JSON order_request et filtrage de tous les articles de commande avec des fournisseurs externes à l'aide de la fonction de mappage FILTER.
Les valeurs filtrées sont ensuite stockées dans la variable de sortie filtered_external_items.
ID de déclencheur d'API:api_trigger/ecom-order-processing_API_2
Nom de l'intégration: ExampleIntegration-EcomOrderProcessing
Itère sur la variable filtered_external_items et appelle la sous-intégration pour chaque élément du tableau. Il rassemble également les réponses obtenues à chaque exécution dans rest_call_response_status, où chaque élément du tableau contient la réponse obtenue pour une exécution spécifique.
URL de base du point de terminaison : https://mocktarget.apigee.net/echo
Méthode HTTP:POST
Corps de la requête: sub_integration_input
Effectue un appel REST à https://mocktarget.apigee.net/echo.
Publier et tester l'exemple d'intégration
Pour publier l'intégration, cliquez sur Publier dans la barre d'outils de l'éditeur d'intégrations.
Une fois l'intégration publiée, vous pouvez afficher et inspecter les journaux d'exécution qui s'y rapportent. Pour afficher les journaux, cliquez sur Afficher les journaux d'exécution pour cette intégration. La page Journaux d'exécution s'affiche.
Tester depuis l'éditeur d'intégration
Pour tester l'exemple d'intégration, procédez comme suit:
Cliquez sur Tester dans la barre d'outils de l'éditeur d'intégrations, puis sélectionnez OrderProcessAPITrigger.
Le volet Tester l'intégration s'affiche.
Vous êtes invité à modifier la variable d'entrée orders_request. Pour les besoins de ce test, vous pouvez remplacer la valeur quantity par 240. La variable d'entrée orders_request de la mise à jour doit se présenter comme suit:
Étant donné que la quantité orders_request mise à jour est supérieure à 200, l'exemple d'intégration envoie une demande d'approbation par e-mail à l'adresse spécifiée dans le champ Destinataires de la tâche Approbation. L'opération d'intégration de la commande sera effectuée une fois l'approbation reçue.
Pour inspecter les journaux d'exécution et afficher l'état et la charge utile de l'intégration donnée, procédez comme suit:
Dans l'éditeur d'intégrations, cliquez sur Afficher les journaux d'exécution pour cette intégration. La page Journaux d'exécution s'affiche.
La page Journaux d'exécution vous permet d'afficher les détails de chaque tentative d'exécution d'une intégration.
Chaque entrée inclut les détails de la tentative d'exécution, y compris les suivants :
Nom de l'intégration
ID d'exécution
État
Start time
Durée
Version d'intégration
ID du déclencheur
Cliquez sur la flèche de développement (>) à côté de l'intégration exécutée pour afficher une liste développée des tâches et des variables dans l'intégration, ainsi que l'état de la tâche et les charges utiles variables.
Tester à l'aide d'un appel d'API REST
Scénario de test 1: Envoyer une requête avec des entrées par défaut
L'API renvoie la réponse d'exécution de l'intégration contenant toutes les valeurs des variables de sortie de l'intégration.
Quotas et limites
Pour plus d'informations sur les quotas et les limites, consultez la section Quotas et limites.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/03 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 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)."]]