Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Créer un workflow à l'aide de la console Google Cloud
Dans ce guide de démarrage rapide, vous allez découvrir comment créer, déployer et exécuter votre premier workflow à l'aide de la console Google Cloud . L'exemple de workflow envoie une requête à une API publique, puis renvoie la réponse de l'API.
Pour obtenir des instructions détaillées sur cette tâche directement dans la console Google Cloud , cliquez sur Visite guidée :
Sign in to your Google Cloud account. If you're new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads.
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.
À moins que vous ne saisissiez votre propre terme de recherche, ce workflow utilise votre emplacementGoogle Cloud pour construire un terme de recherche qu'il transmet à l'API Wikipédia. Une liste d'articles Wikipédia associés est renvoyée.
Sélectionnez Deploy (Déployer).
Exécuter le workflow
Maintenant que votre workflow a été déployé, vous pouvez l'exécuter pour la première fois. Après avoir déployé le workflow, vous êtes redirigé vers la page Détails du workflow.
Sur la page Détails du workflow, cliquez sur play_arrowExécuter.
Sur la page Exécuter le workflow, cliquez sur Exécuter.
Les résultats de votre workflow s'affichent dans le volet Sortie.
Vous avez déployé et exécuté votre premier workflow !
Effectuer un nettoyage
Pour éviter que les ressources utilisées dans cette démonstration soient facturées sur votre compte Google Cloud , procédez comme suit :
Dans la console Google Cloud , accédez à la page Workflows :
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/04 (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/04 (UTC)."],[],[],null,["# Quickstart: Create a workflow by using the Google Cloud console\n\nCreate a workflow by using the Google Cloud console\n===================================================\n\nThis quickstart shows you how to create, deploy, and execute your first workflow\nusing the Google Cloud console. The sample workflow sends a request to a\npublic API and then returns the API's response.\n\n*** ** * ** ***\n\nTo follow step-by-step guidance for this task directly in the\nGoogle Cloud console, click **Guide me**:\n\n[Guide me](https://console.cloud.google.com/freetrial?redirectPath=/?walkthrough_id=workflows--workflows_quickstart)\n\n*** ** * ** ***\n\nBefore you begin\n----------------\n\nSecurity constraints defined by your organization might prevent you from completing the\nfollowing steps. For troubleshooting information, see\n[Develop applications in a constrained Google Cloud environment](/resource-manager/docs/organization-policy/develop-apps-constrained-environment).\n\n- Sign in to your Google Cloud account. If you're new to Google Cloud, [create an account](https://console.cloud.google.com/freetrial) to evaluate how our products perform in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n- In the Google Cloud console, on the project selector page,\n select or create a Google Cloud project.\n\n | **Note**: If you don't plan to keep the resources that you create in this procedure, create a project instead of selecting an existing project. After you finish these steps, you can delete the project, removing all resources associated with the project.\n\n [Go to project selector](https://console.cloud.google.com/projectselector2/home/dashboard)\n-\n [Verify that billing is enabled for your Google Cloud project](/billing/docs/how-to/verify-billing-enabled#confirm_billing_is_enabled_on_a_project).\n\n1. Enable the Workflows API.\n\n [Enable the Workflows API](https://console.cloud.google.com/marketplace/product/google/workflows.googleapis.com)\n2. In the Google Cloud console, go to the **Service Accounts**\n page.\n\n [Go to Service Accounts](https://console.cloud.google.com/iam-admin/serviceaccounts)\n3. Select a project and then click **Create service account**.\n4. In the **Service account name** field, enter a name, such as `sa-name`.\n5. Click **Create and continue**.\n6. To send logs to Cloud Logging, click the **Select a role**\n field and select **Logging \\\u003e Logs Writer**.\n\n To learn more about service account roles and permissions, see\n [Grant a workflow permission to access\n Google Cloud resources](/workflows/docs/authentication).\n7. Click **Done**.\n\n\u003cbr /\u003e\n\nCreate and deploy a workflow\n----------------------------\n\n1. In the Google Cloud console, go to the **Workflows** page:\n\n\n [Go to Workflows](https://console.cloud.google.com/workflows)\n\n \u003cbr /\u003e\n\n2. On the **Workflows** page, click add**Create**.\n\n3. Enter a name for the new workflow, such as `myFirstWorkflow`.\n\n4. Choose **us-central1** for the region.\n\n5. For **service account**, select the service account you created earlier.\n\n6. Select **Next**.\n\n7. In the workflow editor, copy and paste the following workflow:\n\n ### YAML\n\n main:\n params: [input]\n steps:\n - checkSearchTermInInput:\n switch:\n - condition: '${\"searchTerm\" in input}'\n assign:\n - searchTerm: '${input.searchTerm}'\n next: readWikipedia\n - getLocation:\n call: sys.get_env\n args:\n name: GOOGLE_CLOUD_LOCATION\n result: location\n - setFromCallResult:\n assign:\n - searchTerm: '${text.split(location, \"-\")[0]}'\n - readWikipedia:\n call: http.get\n args:\n url: 'https://en.wikipedia.org/w/api.php'\n query:\n action: opensearch\n search: '${searchTerm}'\n result: wikiResult\n - returnOutput:\n return: '${wikiResult.body[1]}'\n\n ### JSON\n\n {\n \"main\": {\n \"params\": [\n \"input\"\n ],\n \"steps\": [\n {\n \"checkSearchTermInInput\": {\n \"switch\": [\n {\n \"condition\": \"${\\\"searchTerm\\\" in input}\",\n \"assign\": [\n {\n \"searchTerm\": \"${input.searchTerm}\"\n }\n ],\n \"next\": \"readWikipedia\"\n }\n ]\n }\n },\n {\n \"getLocation\": {\n \"call\": \"sys.get_env\",\n \"args\": {\n \"name\": \"GOOGLE_CLOUD_LOCATION\"\n },\n \"result\": \"location\"\n }\n },\n {\n \"setFromCallResult\": {\n \"assign\": [\n {\n \"searchTerm\": \"${text.split(location, \\\"-\\\")[0]}\"\n }\n ]\n }\n },\n {\n \"readWikipedia\": {\n \"call\": \"http.get\",\n \"args\": {\n \"url\": \"https://en.wikipedia.org/w/api.php\",\n \"query\": {\n \"action\": \"opensearch\",\n \"search\": \"${searchTerm}\"\n }\n },\n \"result\": \"wikiResult\"\n }\n },\n {\n \"returnOutput\": {\n \"return\": \"${wikiResult.body[1]}\"\n }\n }\n ]\n }\n }\n\n Unless you input your own search term, this workflow uses your\n Google Cloud location to construct a search term, which it passes to\n the [Wikipedia API](https://wikipedia.org/w/api.php). A list of\n related Wikipedia articles is returned.\n8. Select **Deploy**.\n\nExecute the workflow\n--------------------\n\nOnce your workflow has been successfully deployed, you can execute it for the\nfirst time. After deploying the workflow, you'll be taken to its\n**Workflow details** page.\n\n1. On the **Workflow details** page, click play_arrow**Execute**.\n\n2. On the **Execute workflow** page, click **Execute**.\n\n3. In the **Output** pane, your workflow's results are displayed.\n\nYou've deployed and executed your first workflow!\n\nClean up\n--------\n\n\nTo avoid incurring charges to your Google Cloud account for\nthe resources used on this page, follow these steps.\n\n1. In the Google Cloud console, go to the **Workflows** page:\n\n\n [Go to Workflows](https://console.cloud.google.com/workflows)\n\n \u003cbr /\u003e\n\n2. From the list of workflows, click a workflow to go to its\n **Workflow details** page.\n\n3. Click delete**Delete**.\n\n4. Type the name of the workflow and then click **Confirm**.\n\nWhat's next\n-----------\n\n- [Update an existing workflow](/workflows/docs/creating-updating-workflow#updating_a_workflow)\n\n- [Control the order of execution in a workflow](/workflows/docs/controlling-execution-order)\n\n- [Sample workflows](/workflows/docs/samples)\n\n- [Workflows syntax reference](/workflows/docs/reference/syntax)"]]