Legen Sie die Umgebungsvariable ENDPOINTS_GAE_SDK auf den Pfad des App Engine SDK-Ordners fest: Path_to_Cloud_SDK/platform/google_appengine.
Ersetzen Sie Path_to_Cloud_SDK durch die Ausgabe des folgenden Befehls:
gcloudinfo--format="value(installation.sdk_root)"
Führen Sie den folgenden Befehl im Hauptverzeichnis der API aus:
gcloudappdeploy
Warten Sie kurz, bis die Bereitstellung abgeschlossen ist. Ignorieren Sie die Warnmeldungen. Nach Abschluss der Bereitstellung erhalten Sie in etwa folgende Meldung:
File upload done.
Updating service [default]...done.
Prüfen Sie die erfolgreiche Bereitstellung, indem Sie eine Testanfrage an die API senden. Beispiel:
Informationen zu Versionsverwaltung der API und zum Bereitstellen von Versionen finden Sie unter API-Versionsverwaltung handhaben.
API lokal testen
Sie können Ihre API mit dem lokalen App Engine-Entwicklungsserver lokal testen. Weitere Informationen zum lokalen Entwicklungsserver finden Sie unter Lokalen Entwicklungsserver verwenden.
So führen Sie die API lokal aus:
Starten Sie den App Engine-Entwicklungsserver vom Stammverzeichnis des Projekts aus:
dev_appserver.py YOUR_PROJECT_DIR
Führen Sie curl aus, um eine API-Anfrage zu senden. Beispiel:
Damit Ihre API von Endpoints Frameworks verwaltet werden kann, müssen Sie ein OpenAPI-Dokument generieren und bereitstellen, das Ihre API wie unter API-Verwaltung hinzufügen dargestellt beschreibt.
[[["Leicht verständlich","easyToUnderstand","thumb-up"],["Mein Problem wurde gelöst","solvedMyProblem","thumb-up"],["Sonstiges","otherUp","thumb-up"]],[["Schwer verständlich","hardToUnderstand","thumb-down"],["Informationen oder Beispielcode falsch","incorrectInformationOrSampleCode","thumb-down"],["Benötigte Informationen/Beispiele nicht gefunden","missingTheInformationSamplesINeed","thumb-down"],["Problem mit der Übersetzung","translationIssue","thumb-down"],["Sonstiges","otherDown","thumb-down"]],["Zuletzt aktualisiert: 2025-09-04 (UTC)."],[[["\u003cp\u003eThis guide details the process of deploying an API, which includes setting up the environment, creating the API and web server, and then deploying to production.\u003c/p\u003e\n"],["\u003cp\u003eTo deploy to production, you must set the \u003ccode\u003eENDPOINTS_GAE_SDK\u003c/code\u003e environment variable and use the \u003ccode\u003egcloud app deploy\u003c/code\u003e command, then confirm deployment by making a test request.\u003c/p\u003e\n"],["\u003cp\u003eAPIs can be tested locally using the App Engine development server, started via \u003ccode\u003edev_appserver.py YOUR_PROJECT_DIR\u003c/code\u003e, followed by sending a test \u003ccode\u003ecurl\u003c/code\u003e request.\u003c/p\u003e\n"],["\u003cp\u003eEndpoints Frameworks offers API management features, such as monitoring, logging, quotas, and a developer portal, which are enabled by deploying an OpenAPI document.\u003c/p\u003e\n"],["\u003cp\u003eVersioning can be done by referring to the "Handling API versioning" page.\u003c/p\u003e\n"]]],[],null,["# Deploying and testing an API\n\nThis page describes how to deploy your API.\n\nBefore you begin\n----------------\n\n- [Set up your programming environment and download tools](/endpoints/docs/frameworks/python/get-started-frameworks-python#before-you-begin).\n- [Create your API](/endpoints/docs/frameworks/python/create_api).\n- [Create a web server](/endpoints/docs/frameworks/python/api_server) to serve your API.\n\nDeploying your API to production\n--------------------------------\n\nTo deploy an API:\n\n1. Set the `ENDPOINTS_GAE_SDK` environment variable to the path of your\n App Engine SDK folder:\n \u003cvar translate=\"no\"\u003ePath_to_Cloud_SDK\u003c/var\u003e`/platform/google_appengine`.\n\n Replace \u003cvar translate=\"no\"\u003ePath_to_Cloud_SDK\u003c/var\u003e with the output of the\n following command: \n\n gcloud info --format=\"value(installation.sdk_root)\"\n\n2. Run the following command in the API main directory:\n\n gcloud app deploy\n\n Wait a few moments for the deployment to succeed, ignoring the warning\n messages. When the deployment completes, a message similar to the\n following displays: \n\n ```\n File upload done.\n Updating service [default]...done.\n ```\n3. Confirm successful deployment by sending a test request to the API, for\n example:\n\n ```\n curl --request POST \\\n --header \"Content-Type: application/json\" \\\n --data '{\"content\":\"echo\"}' \\\n https://PROJECT_ID.appspot.com/_ah/api/echo/v1/echo?n=2\n ```\n\n Replace \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e with your project ID and\n `echo` with your API name.\n\n The results are: \n\n ```\n {\n \"content\": \"echo echo\"\n }\n ```\n\nIf you didn't get a successful response, see\n[Troubleshooting response errors](/endpoints/docs/frameworks/troubleshoot-response-errors).\n\nDeploying to multiple app versions\n----------------------------------\n\nFor information on how to do API versioning, and how to deploy to versions,\nsee [Handling API versioning](/endpoints/docs/frameworks/python/handling-api-versioning)\n\nTesting an API locally\n----------------------\n\nYou can use the App Engine local development server to test your API\nlocally. For more information about the local development server, see\n[Using the local development server](/appengine/docs/standard/python/tools/using-local-server).\n\nTo run your API locally:\n\n1. From the root directory of the project, start the App Engine\n development server:\n\n ```\n dev_appserver.py YOUR_PROJECT_DIR\n ```\n2. Run `curl` to make an API request, for example:\n\n curl --request POST \\\n --header \"Content-Type: application/json\" \\\n --data '{\"message\":\"echo\"}' \\\n \"${HOST}/_ah/api/echo/v1/echo?n=2\"\n\nAdding API management\n---------------------\n\nEndpoints Frameworks provides API management features such as:\n\n- [Monitoring](/endpoints/docs/frameworks/monitoring-your-api)\n- [Logging](/endpoints/docs/frameworks/monitoring-your-api#logs)\n- [Quotas](/endpoints/docs/openapi/quotas-overview)\n- [Developer portal](/endpoints/docs/openapi/dev-portal-overview)\n\nFor your API to be managed by Endpoints Frameworks, you must generate\nand deploy an OpenAPI document that describes your API, as described in\n[Adding API management](/endpoints/docs/frameworks/python/adding-api-management)."]]