Combinez des règles et des ressources au sein d'un flux partagé : cela vous permet d'utiliser ce flux depuis plusieurs proxys d'API, et même depuis d'autres flux partagés. Bien qu'il soit comparable à un proxy, un flux partagé ne possède pas de point de terminaison. Il ne peut être utilisé que depuis un proxy d'API ou un flux partagé appartenant à la même organisation que le flux partagé lui-même.
Pour créer un flux partagé à l'aide d'Apigee dans Cloud Code, procédez comme suit :
Effectuez l'une des opérations suivantes :
Placez le curseur sur le dossier sharedflows dans votre espace de travail local, puis cliquez sur .
Cliquez sur Afficher > Palette de commandes pour ouvrir la palette de commandes, puis sélectionnez Cloud Code : Créer un groupe de flux partagés Apigee.
L'assistant "Créer un flux partagé" s'ouvre.
Saisissez un nom unique pour le flux partagé lorsque l'invite s'affiche, puis appuyez sur Entrée.
Une fois la procédure de l'assistant terminée, le nouveau nom de flux partagé s'affiche sous sharedflows dans la section Apigee. Chaque dossier de flux partagé est structuré comme décrit dans la section Structure du répertoire de groupe de flux partagé.
Importer un groupe de flux partagé
Pour importer un groupe de flux partagé à l'aide d'Apigee dans Cloud Code, procédez comme suit :
Effectuez l'une des actions suivantes :
Dans votre espace de travail local, placez le curseur sur le dossier sharedflows et cliquez sur .
Cliquez sur Afficher > Palette de commandes pour ouvrir la palette de commandes, puis sélectionnez Cloud Code : Importer un groupe de flux partagés Apigee.
Accédez au groupe de flux partagé que vous souhaitez importer, puis cliquez sur Importer un flux partagé.
Le groupe de flux partagé doit être structuré comme décrit dans la section Structure du répertoire d'un groupe de flux partagé.
(Facultatif) Par défaut, le nom du fichier ZIP moins son extension est utilisé pour le nom du flux partagé. Si ce nom n'est pas unique, vous êtes invité à en saisir un.
Le dossier de flux partagé importé est ajouté sous sharedflows dans votre espace de travail Apigee.
Configurer des flux partagés
Configurez les flux partagés, comme décrit dans les rubriques suivantes :
Vous pouvez appeler un flux partagé à l'aide de la stratégie FlowCallout, comme décrit dans la règle FlowCallout.
En outre, en associant un flux partagé à un hook de flux, vous pouvez exécuter le flux partagé avant une demande proxy ou cible, ou après une réponse proxy ou cible. Pour en savoir plus, consultez les pages suivantes :
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\u003eThis page covers creating and managing shared flows in Apigee and Apigee hybrid, which are reusable sequences of policies and resources.\u003c/p\u003e\n"],["\u003cp\u003eShared flows are similar to API proxies but lack endpoints, and they are called from API proxies or other shared flows within the same organization.\u003c/p\u003e\n"],["\u003cp\u003eYou can create a new shared flow using Apigee in Cloud Code by using a wizard or command, which involves specifying a unique name.\u003c/p\u003e\n"],["\u003cp\u003eShared flow bundles can be imported into Apigee in Cloud Code, and you can configure shared flows by creating reusable ones, adding policies and managing resources.\u003c/p\u003e\n"],["\u003cp\u003eShared flows can be called via the FlowCallout policy or by attaching them to flow hooks, allowing execution before or after proxy or target requests/responses, but runtime dependency validation is necessary.\u003c/p\u003e\n"]]],[],null,["# Developing shared flows\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\n\n*View [Apigee Edge](https://docs.apigee.com/api-platform/get-started/what-apigee-edge) documentation.*\n\n\u003cbr /\u003e\n\nCombine policies and resources into a shared flow that you can consume from multiple API proxies, and even from other shared flows. Although it's like a proxy, a shared flow has no endpoint. It can be used only from an API proxy or shared flow that's in the same organization as the shared flow itself.\n\nDevelop your shared flows using Apigee in Cloud Code as described in the following sections. See also [Managing folders and files in an Apigee workspace](/apigee/docs/api-platform/local-development/vscode/manage-apigee-workspace#manage-folders-files).\n| **Before you begin** : Familiarize yourself with the concepts described in the following topics:\n|\n| - [Creating reusable shared flows](/apigee/docs/api-platform/fundamentals/shared-flows)\n| - [Attaching a shared flow using a flow hook](/apigee/docs/api-platform/fundamentals/flow-hooks)\n\nCreating a shared flow\n----------------------\n\nTo create a shared flow using Apigee in Cloud Code:\n\n1. Perform one of the following steps:\n\n - Position your cursor over the **sharedflows** folder in your local\n workspace and click\n .\n\n - Select **View \\\u003e Command Palette** to open the Command palette and select **Cloud Code: Create Apigee shared flow bundle**.\n\n The Create shared flow wizard opens.\n2. Enter a unique name for the shared flow at the prompt and press \u003ckbd\u003eEnter\u003c/kbd\u003e.\n\nAfter you complete the steps in the wizard, the new shared flow name appears\nunder **sharedflows** in the Apigee section. Each shared flow folder is structured as described in [Shared flow bundle directory structure](/apigee/docs/api-platform/reference/shared-flow-bundle-configuration-reference#sharedflowbundlestructure)\n\nUploading a shared flow bundle\n------------------------------\n\nTo upload a shared flow bundle using Apigee in Cloud Code:\n\n1. Perform one of the following actions:\n\n - In your local workspace, position your cursor over the **sharedflows** folder and click .\n\n - Select **View \\\u003e Command Palette** to open the Command palette and select **Cloud Code: Import Apigee shared flow bundle**.\n\n2. Navigate to the shared flow bundle that you want to upload and click **Import shared flow** .\n The shared flow bundle must be structured as described in [Shared flow bundle directory structure](/apigee/docs/api-platform/reference/shared-flow-bundle-configuration-reference#sharedflowbundlestructure).\n\n3. (Optional) By default, the name of the zip file minus its extension is used for the name of the shared flow. If this name is not unique, you are prompted to enter a unique name.\n\nThe uploaded shared flow folder is added under **sharedflows** in your Apigee workspace.\n\nConfiguring shared flows\n------------------------\n\nConfigure shared flows as described in the following topics:\n\n- [Creating reusable shared flows](/apigee/docs/api-platform/fundamentals/shared-flows)\n- [Adding features using policies](/apigee/docs/api-platform/local-development/vscode/manage-policies)\n- [Managing resources](/apigee/docs/api-platform/local-development/vscode/manage-resources)\n\nUsing shared flows\n------------------\n\nYou can call a shared flow using the FlowCallout policy, as described in [FlowCallout policy](/apigee/docs/api-platform/reference/policies/flow-callout-policy).\n\nIn addition, by attaching a shared flow to a flow hook you can execute the shared flow before a proxy or target request, or after a proxy or target response. For more information, see:\n\n- [Attaching a shared flow using a flow hook](/apigee/docs/api-platform/fundamentals/flow-hooks) (conceptual overview)\n- [Attaching shared flows using flow hooks (flowhooks.json)](/apigee/docs/api-platform/local-development/vscode/deploy-environment#attaching_shared_flows_using_flow_hooks_flowhooksjson) (steps using Apigee in Cloud Code)\n\n\u003cbr /\u003e\n\n| **Note:** Apigee does not validate the dependencies between shared flows and API proxies at deploy time. For example, if the FlowCallout policy in an API proxy references a shared flow that either doesn't exist or isn't deployed, API proxy deployment still succeeds. When Apigee checks the dependency at runtime and validation fails, Apigee throws an API proxy error with a `500` HTTP status code."]]