Déterminer l'URL du point de terminaison du proxy d'API
Lorsque vous déployez votre environnement, l'URL du point de terminaison du proxy d'API s'affiche dans la section Émulateurs, sous Déploiements actifs.
Pour copier l'URL du point de terminaison du proxy d'API, placez votre curseur sur l'URL et cliquez sur .
L'URL de votre point de terminaison de proxy d'API est structurée comme suit :
Par défaut, l'hôte et le port (trafic) utilisent 0 et 8998, respectivement.
Vous définissez le port lors de l'installation de l'émulateur Apigee, ainsi que les valeurs de chemin base et de ressource lors du développement de votre proxy d'API.
Tester des API avec curl
Pour tester vos API à l'aide de curl, ouvrez l'onglet Terminal et exécutez un appel à votre API.
Exemple :
curl 0:8998/helloworld
S'authentifier à l'aide d'une clé API
Si votre API nécessite une authentification basée sur une clé API :
Créez et exportez les ressources de test de produit d'API, de développeur et d'application de développement, comme décrit dans la section Créer des ressources de test.
Cliquez sur Applications de développement actives dans la section Ressources de test actives de l'émulateur Apigee, puis copiez la valeur consumerKey (sans les guillemets) du produit d'API, comme indiqué dans figure suivante.
Transmettez la clé API dans votre appel curl, comme requis par votre API. Par exemple, l'appel curl suivant transmet la clé API dans le paramètre de requête apikey :
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/05 (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/05 (UTC)."],[[["\u003cp\u003eThis page provides guidance on testing APIs within both Apigee and Apigee hybrid environments.\u003c/p\u003e\n"],["\u003cp\u003eThe URL for an API proxy endpoint is found within the "emulators" section under "Active deployments" and typically consists of a host and port, basepath, and resource.\u003c/p\u003e\n"],["\u003cp\u003eYou can test APIs using curl by opening the "Terminal" tab and executing a call to your API endpoint, with examples provided.\u003c/p\u003e\n"],["\u003cp\u003eAPI key-based authentication can be implemented by building and exporting relevant test resources, such as API products, developers, and developer apps, and passing the \u003ccode\u003econsumerKey\u003c/code\u003e value in the curl request.\u003c/p\u003e\n"],["\u003cp\u003eBefore testing an API, it may be necessary to create and export a test set of resources, mirroring a production environment, such as API products, developers, and apps.\u003c/p\u003e\n"]]],[],null,["# Testing APIs\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\nTest APIs 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| **Note:** Before you test an API, you may need to build and export a set of test resources, such as API products, developers, or apps, that represent those same resources that might exist in your production environment. See [Building and exporting test resources](/apigee/docs/api-platform/local-development/vscode/build-test-resources).\n\nDetermining the URL of the API proxy endpoint\n---------------------------------------------\n\nWhen you deploy your environment, the URL of the API proxy endpoint is displayed in the **emulators** section, under **Active deployments**.\n\nTo copy the URL for the API proxy endpoint, position your cursor over the URL and click .\n\nThe URL for your API proxy endpoint is structured as follows: \n\n```\n\nhttps://0:8998/shopping/cart/addItem\n |_____||____________||______|\n | | |\n host+port basepath resource\n```\n\nBy default, the host and port (traffic) default to `0`\nand `8998`, respectively.\n\nYou define the port when installing the Apigee Emulator, and the basepath and resource values when [developing your API proxy](/apigee/docs/api-platform/local-development/vscode/develop-apiproxies).\n\nUsing curl to test your APIs\n----------------------------\n\nTo test your APIs using curl, open the **Terminal** tab and execute a call to your API.\n\nFor example: \n\n```\ncurl 0:8998/helloworld\n```\n\nAuthenticating using an API key\n-------------------------------\n\nIf your API requires API key-based authentication:\n\n- Build and export the API product, developer, and developer app test resources, as described in [Building test resources](/apigee/docs/api-platform/local-development/vscode/build-test-resources)\n- Click **Active developer apps** in the **Active test resources** section of the Apigee Emulator and copy the `consumerKey` value (without the quotes) for the API product, as shown in the following figure.\n\nPass the API key in your curl call, as required by your API. For example, the following curl call passes the API key in the `apikey` query parameter: \n\n```\ncurl 0:8998/helloworld?apikey=ZQA5euYtNeJ7ZCGCJMpvd6F2BZOmxOzY\n```"]]