Mit Sammlungen den Überblick behalten
Sie können Inhalte basierend auf Ihren Einstellungen speichern und kategorisieren.
Diese Seite gilt für Apigee und Apigee Hybrid.
In diesem Dokument wird beschrieben, wie Sie Abhängigkeiten zwischen registrierten APIs erstellen und verwalten.
Abhängigkeiten helfen Ihnen, die Beziehungen zwischen APIs zu erkennen. Weitere Informationen finden Sie unter Einführung in Abhängigkeiten.
Auf der Benutzeroberfläche sehen Sie auf einen Blick die Beziehung zwischen den APIs des Nutzers und des Anbieters, wobei der Nutzer von einem Vorgang des Anbieters abhängig ist. Siehe Abbildung 1.
Abbildung 1: Auf der Benutzeroberfläche für API-Abhängigkeiten werden Nutzer-/Anbieterpaare angezeigt, bei denen ein Nutzervorgang von einem Anbietervorgang abhängt. Sie können ganz einfach eine Aufschlüsselung vornehmen, um die Details der einzelnen Abhängigkeiten zu sehen. Sie können die Tabelle auch nach Nutzer- und/oder Anbieteraktionen filtern.
Abhängigkeit erstellen
Sie können eine Abhängigkeitsentität mit der REST API erstellen.
Console
So erstellen Sie eine Abhängigkeit:
Rufen Sie in der Google Cloud Console im API-Hub die Seite Lieferkette auf.
curl -X POST 'https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/dependencies?dependency_id=DEPENDENCY_ID' \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H 'Content-Type: application/json' \
--d '{
"description": "DESCRIPTION",
"supplier": {
// Specify one of the following:
"operation_resource_name": RESOURCE_NAME
// OR
"external_api_resource_name: RESOURCE_NAME"
},
"consumer": {
// Specify one of the following:
"operation_resource_name": RESOURCE_NAME
// OR
"external_api_resource_name: RESOURCE_NAME"
}
}'
Ersetzen Sie Folgendes:
HUB_PROJECT ist der Name des API-Hub-Hostprojekts. Das Hostprojekt wurde bei der Bereitstellung des API-Hubs ausgewählt.
HUB_LOCATION: der Standort des Hostprojekts. Der Standort wurde bei der Bereitstellung des API-Hubs ausgewählt.
DEPENDENCY_ID: (Optional) Die Kennung der Abhängigkeit. Wenn nicht angegeben, wird eine vom System generierte ID verwendet. Der Name muss ein String mit 4 bis 500 Zeichen sein, wobei gültige Zeichen /[a-z][A-Z][0-9]-_. sind.
DESCRIPTION: (Optional) Eine kurze Beschreibung der Abhängigkeit.
RESOURCE_NAME: (Erforderlich) Entweder der Ressourcenname eines Vorgangs im API-Hub oder einer externen API, je nachdem, welches Attribut Sie angeben.
Ressourcennamen für Vorgänge haben folgendes Format: projects/PROJECT/locations/LOCATION/apis/API/versions/VERSION/operations/OPERATION.
Beispiel für eine Vorgangsressource: "projects/myproject/locations/us-central1/apis/payments-api/versions/locationv1/operations/getlocation".
Namen externer API-Ressourcen haben folgendes Format: projects/PROJECT/locations/LOCATION/externalApis/EXTERNAL_API
Beispiel für eine externe API-Ressource: "projects/myproject/locations/us-central1/externalApis/petstore".
Beispielantwort:
{
"name": "projects/myproject/locations/us-central1/dependencies/user-to-pet",
"consumer": {
"displayName": "POST - /v2/user",
"operationResourceName": "projects/myproject/locations/us-central1/apis/payments-api/versions/version1/operations/createuser"
},
"supplier": {
"displayName": "POST - /v2/pet",
"operationResourceName": "projects/myproject/locations/us-central1/apis/payments-api/versions/version1/operations/addpet"
},
"state": "VALIDATED",
"description": "Dependency from user to pet API",
"discoveryMode": "MANUAL",
"createTime": "2024-04-17T19:33:31.664226Z",
"updateTime": "2024-04-17T19:33:31.664226Z"
}
Beispiel-REST
curl -X POST 'https://apihub.googleapis.com/v1/projects/myproject/locations/us-central1/dependencies?dependency_id=user-to-pet' \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H 'Content-Type: application/json' \
--d '{
"description": "Dependency from user to pet API",
"consumer": {
"operation_resource_name": "projects/myproject/locations/us-central1/apis/payments-api/versions/paymentv1/operations/createuser"
},
"supplier": {
"operation_resource_name": "projects/myproject/locations/us-central1/apis/pet-api/versions/petstorev1/operations/addpet"
}
}'
Abhängigkeiten auflisten
In diesem Abschnitt wird erläutert, wie Sie die Abhängigkeiten auflisten. Sie können alle Abhängigkeiten auflisten, die mit allen Versionen einer API verknüpft sind, oder alle Abhängigkeiten, die mit einer bestimmten Version verknüpft sind.
Console
So listen Sie Abhängigkeiten auf:
Rufen Sie in der Google Cloud Console im API-Hub die Seite Lieferkette auf.
Die Liste der bekannten Abhängigkeiten wird auf der Seite „Lieferkette“ angezeigt.
Geben Sie im Feld Filter bei Bedarf Anbieter- und/oder Verbrauchervorgänge an, um relevante Abhängigkeiten zurückzugeben. Mit der Filterfunktion können Sie alle Abhängigkeiten finden, die mit bestimmten Vorgängen verknüpft sind.
In diesem Abschnitt wird erläutert, wie Sie die Details zu einer API-Abhängigkeit mit der REST API abrufen. Sie können sich Details zu Nutzern und Anbietern sowie Details zur Abhängigkeit ansehen, einschließlich Fehler, die beispielsweise auf eine unterbrochene Abhängigkeit hinweisen können.
Console
So rufen Sie eine Abhängigkeit ab:
Rufen Sie in der Google Cloud Console im API-Hub die Seite Lieferkette auf.
Geben Sie im Feld Filter bei Bedarf Anbieter- und/oder Verbrauchervorgänge an, um relevante Abhängigkeiten zurückzugeben. Mit der Filterfunktion können Sie alle Abhängigkeiten finden, die mit bestimmten Vorgängen verknüpft sind.
Suchen Sie nach einer relevanten Abhängigkeit und klicken Sie auf Details ansehen.
Geben Sie im Feld Filter bei Bedarf Anbieter- und/oder Verbrauchervorgänge an, um relevante Abhängigkeiten zurückzugeben. Mit der Filterfunktion können Sie alle Abhängigkeiten finden, die mit bestimmten Vorgängen verknüpft sind.
Lokalisieren Sie die relevante Abhängigkeit und klicken Sie auf das Löschsymbol, um sie zu löschen.
REST
Verwenden Sie die API Abhängigkeit löschen, um eine Abhängigkeit aus dem API-Hub zu löschen:
Geben Sie im Feld Filter bei Bedarf Anbieter- und/oder Nutzervorgänge an, um relevante Abhängigkeiten zu erhalten. Mit der Filterfunktion können Sie alle Abhängigkeiten finden, die mit bestimmten Vorgängen verknüpft sind.
Lokalisieren Sie die relevante Abhängigkeit und klicken Sie auf Details ansehen.
Auf der Seite Abhängigkeit können Sie die Beschreibung und die Attribute bearbeiten. Verwenden Sie das Bearbeitungssymbol, um die Bearbeitung dieser Felder zu aktivieren.
[[["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-08-28 (UTC)."],[[["\u003cp\u003eThis document explains how to manage API dependencies within Apigee and Apigee hybrid, allowing users to visualize and understand the relationships between different APIs.\u003c/p\u003e\n"],["\u003cp\u003eDependencies, which are defined by a consumer operation relying on a supplier operation, can be created, listed, and managed through the Google Cloud console or via REST APIs.\u003c/p\u003e\n"],["\u003cp\u003eThe API hub UI provides a visual overview of consumer/supplier relationships, and the dependencies can be filtered to focus on specific operations of interest, as well as show details on the consumer and supplier.\u003c/p\u003e\n"],["\u003cp\u003eUsers can also get details about dependencies to look for errors, including information about broken dependencies where the supplier operation is removed, and can delete or edit these dependencies as needed.\u003c/p\u003e\n"],["\u003cp\u003eThe dependency ID must be 4-500 characters long and only contain letters, numbers and hyphens when creating a dependency.\u003c/p\u003e\n"]]],[],null,["# Manage API supply chain dependencies\n\n*This page\napplies to **Apigee** and **Apigee hybrid**.*\n\nThis page explains how to manage API supply chain dependencies in API hub. For an overview of API supply chain in API hub, see [API supply chain](./api-supply-chain).\n\n\u003cbr /\u003e\n\nList dependencies\n-----------------\n\nYou can view or list all the dependencies in your API ecosystem using Google Cloud console or the [List dependencies](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.dependencies/list) API. \n\n### Console\n\nTo list all the dependencies in your API ecosystem from API hub, do the following:\n\n1. In the Google Cloud console, go to **API hub \\\u003e** **API supply chain**.\n\n [Go to API hub](https://console.cloud.google.com/apigee/api-hub/dependencies)\n\n The **API supply chain** page appears displaying all the dependencies in your API ecosystem in [list view](./api-supply-chain#api-supply-chain-list-view).\n2. In the **Filter** field, if needed, specify supplier and/or consumer operations to return relevant dependencies. The filter feature lets you find all dependencies linked with specified operations.\n3. To view the dependencies in [graph view](./api-supply-chain#api-supply-chain-graph-view), click lan **(Open graph view)** beside the consumer or supplier name in the list.\n\n### REST\n\nTo list all the dependencies using the [List dependencies](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.dependencies/list) API, use the following command: \n\n```\n curl \"https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/dependencies\"\n -H \"Authorization: Bearer: $(gcloud auth print-access-token)\" -X GET -H \"Content-Type: application/json\"\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eHUB_PROJECT\u003c/var\u003e: The name of your API hub host project. The host project was selected when API hub was provisioned.\n- \u003cvar translate=\"no\"\u003eHUB_LOCATION\u003c/var\u003e: The location of the host project. The location was chosen when API hub was provisioned.\n\nSample output: \n\n```\n{\n \"dependencies\": [\n {\n \"name\": \"projects/myproject/locations/us-central1/dependencies/user-to-pet\",\n \"consumer\": {\n \"displayName\": \"POST - /v2/user\",\n \"operationResourceName\": \"projects/myproject/locations/us-central1/apis/payments-api/versions/version1/operations/createuser\"\n },\n \"supplier\": {\n \"displayName\": \"POST - /v2/pet\",\n \"operationResourceName\": \"projects/myproject/locations/us-central1/apis/payments-api/versions/version1/operations/addpet\"\n }\n }\n ]\n }\n```\n\nView dependency details\n-----------------------\n\nYou can view the dependency details between API operations using Google Cloud console or the [Get dependency details](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.dependencies/get) API.\n\n\u003cbr /\u003e\n\n### Console\n\nTo view the details of a dependency from the Google Cloud console, do the following:\n\n1. In the Google Cloud console, go to **API hub \\\u003e** **API supply chain**.\n\n [Go to API hub](https://console.cloud.google.com/apigee/api-hub/dependencies)\n\n The **API supply chain** page appears displaying all the dependencies in your API ecosystem in [list view](./api-supply-chain#api-supply-chain-list-view).\n2. In the **Filter** field, if needed, specify supplier and/or consumer operations to return relevant dependencies. The filter feature lets you find all dependencies linked with specified operations.\n3. Locate the desired dependency and click **See Details** .\n\n The **Dependency** pane appears displaying detailed information about the dependency such as the consumer and supplier details, dependency details, and the user defined attributes.\n\nAlternatively, you can also use the API supply chain graph view to view the dependency details. For more information, see [API supply chain graph edge](./api-supply-chain#edges).\n\n### REST\n\nTo view details of a dependency using the [Get dependency details](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.dependencies/get) API, use the following command: \n\n```\n curl \"https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/dependencies/DEPENDENCY_ID\"\n -H \"Authorization: Bearer: $(gcloud auth print-access-token)\" -X GET -H \"Content-Type: application/json\"\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eHUB_PROJECT\u003c/var\u003e: The name of your API hub host project. The host project was selected when API hub was provisioned.\n- \u003cvar translate=\"no\"\u003eHUB_LOCATION\u003c/var\u003e: The location of the host project. The location was chosen when API hub was provisioned.\n- \u003cvar translate=\"no\"\u003eDEPENDENCY_ID\u003c/var\u003e: The unique ID of the dependency.\n\nSample response: \n\n```\n{\n \"name\": \"projects/myproject/locations/us-central1/dependencies/user-to-pet\",\n \"consumer\": {\n \"displayName\": \"POST - /v2/user\",\n \"operationResourceName\": \"projects/myproject/locations/us-central1/apis/payments-api/versions/version1/operations/createuser\"\n },\n \"supplier\": {\n \"displayName\": \"POST - /v2/pet\",\n \"operationResourceName\": \"projects/myproject/locations/us-central1/apis/payments-api/versions/version1/operations/addpet\"\n },\n \"state\": \"VALIDATED\",\n \"description\": \"Dependency from user to pet API\",\n \"discoveryMode\": \"MANUAL\",\n \"createTime\": \"2024-04-17T19:33:31.215978712Z\",\n \"updateTime\": \"2024-04-17T19:33:31.737505297Z\"\n}\n```\n\nHere's a sample response, where the error condition indicates the supplier operation was removed\n(a broken dependency): \n\n```\n{\n \"name\": \"projects/common-dev-15/locations/us-central1/dependencies/user-to-pet\",\n \"consumer\": {\n \"displayName\": \"POST - /v2/user\",\n \"operationResourceName\": \"projects/common-dev-15/locations/us-central1/apis/payments-api/versions/2ff89c88-e8b6-48c4-a1c2-bdbb2a929bde/operations/createuser\"\n },\n \"supplier\": {\n \"displayName\": \"POST - /v2/pet\",\n \"operationResourceName\": \"projects/common-dev-15/locations/us-central1/apis/payments-api/versions/2ff89c88-e8b6-48c4-a1c2-bdbb2a929bde/operations/addpet\"\n },\n \"state\": \"VALIDATED\",\n \"description\": \"Dependency from user to pet API\",\n \"discoveryMode\": \"MANUAL\",\n \"createTime\": \"2024-04-17T19:33:31.215978712Z\",\n \"updateTime\": \"2024-04-17T19:33:31.737505297Z\",\n {\n \"error\": \"SUPPLIER_NOT_FOUND\",\n \"errorTime\": 2024-05-18T20:23:42.465324Z\n }\n}\n```\n\nEdit a dependency\n-----------------\n\nYou can edit a dependency using Google Cloud console or the [Patch dependency](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.dependencies/patch) API.\n**Note:** The only editable attribute is the dependency description. \n\n### Console\n\nTo edit an API dependency from API hub, do the following:\n\n1. In the Google Cloud console, go to **API hub \\\u003e** **API supply chain**.\n\n [Go to API hub](https://console.cloud.google.com/apigee/api-hub/dependencies)\n\n The **API supply chain** page appears displaying all the dependencies in your API ecosystem in [list view](./api-supply-chain#api-supply-chain-list-view).\n2. Locate the dependency that you want to edit and click **See Details** .\n\n The **Dependency** pane appears.\n3. Edit the description of the dependency under **Dependency details**.\n4. Click **Save**.\n\n### REST\n\nTo edit a dependency using the [Patch dependencies](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.dependencies/patch) API, use the following command: \n\n```\n curl \"https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/dependencies/DEPENDENCY_ID\"\n -H \"Authorization: Bearer: $(gcloud auth print-access-token)\" -X PATCH -H \"Content-Type: application/json\"\n '{\n 'description': DESCRIPTION\n }'\n \n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eHUB_PROJECT\u003c/var\u003e: The name of your API hub host project. The host project was selected when API hub was provisioned.\n- \u003cvar translate=\"no\"\u003eHUB_LOCATION\u003c/var\u003e: The location of the host project. The location was chosen when API hub was provisioned.\n- \u003cvar translate=\"no\"\u003eDEPENDENCY_ID\u003c/var\u003e: The ID of the dependency to edit.\n- \u003cvar translate=\"no\"\u003eDESCRIPTION\u003c/var\u003e: The description of the dependency.\n\nDelete a dependency\n-------------------\n\nYou can delete a dependency using Google Cloud console or the [Delete dependency](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.dependencies/delete) API. \n\n### Console\n\nTo delete a dependency from API hub, do the following:\n\n1. In the Google Cloud console, go to **API hub \\\u003e** **API supply chain**.\n\n [Go to API hub](https://console.cloud.google.com/apigee/api-hub/dependencies)\n\n The **API supply chain** page appears displaying all the dependencies in your API ecosystem in [list view](./api-supply-chain#api-supply-chain-list-view).\n2. In the **Filter** field, if needed, specify supplier and/or consumer operations to return relevant dependencies. The filter feature lets you find all dependencies linked with specified operations.\n3. Locate a dependency of interest and click delete **(Delete dependency)** to delete the dependency.\n\n### REST\n\nTo delete a dependency using the [Delete dependency](/apigee/docs/reference/apis/apihub/rest/v1/projects.locations.dependencies/delete) API, use the following command: \n\n```\ncurl \"https://apihub.googleapis.com/v1/projects/HUB_PROJECT/locations/HUB_LOCATION/dependencies/DEPENDENCY_ID\"\n -H \"Authorization: Bearer: $(gcloud auth print-access-token)\" -X DELETE -H \"Content-Type: application/json\"\n```\n\nReplace the following:\n\n- \u003cvar translate=\"no\"\u003eHUB_PROJECT\u003c/var\u003e: The name of your API hub host project. The host project was selected when API hub was provisioned.\n- \u003cvar translate=\"no\"\u003eHUB_LOCATION\u003c/var\u003e: The location of the host project. The location was chosen when API hub was provisioned.\n- \u003cvar translate=\"no\"\u003eDEPENDENCY_ID\u003c/var\u003e: The ID of the dependency to delete."]]