Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
Halaman ini
berlaku untuk Apigee dan Apigee hybrid.
Dokumen ini menjelaskan cara membuat dan mengelola dependensi antar-API terdaftar.
Dependensi membantu Anda melihat hubungan antar-API. Lihat
Pengantar dependensi.
UI memungkinkan Anda melihat sekilas hubungan antara API konsumen dan pemasok, dengan konsumen bergantung pada operasi dari pemasok. Lihat Gambar 1.
Gambar 1. UI dependensi API menampilkan pasangan konsumen/pemasok, dengan
operasi konsumen bergantung pada operasi pemasok. Anda dapat dengan mudah melihat detail setiap dependensi. Anda juga dapat memfilter tabel menurut operasi konsumen dan/atau pemasok.
Membuat dependensi
Anda dapat membuat entity dependensi dengan REST API.
Konsol
Untuk membuat dependensi:
Di konsol Google Cloud, buka halaman Supply chain di API hub.
Nama resource API eksternal mengikuti format ini: projects/PROJECT/locations/LOCATION/externalApis/EXTERNAL_API
Contoh resource API eksternal: "projects/myproject/locations/us-central1/externalApis/petstore".
Contoh respons:
{
"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"
}
Contoh 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"
}
}'
Mencantumkan dependensi
Bagian ini menjelaskan cara mencantumkan dependensi. Anda dapat mencantumkan semua dependensi yang terkait
dengan semua versi untuk API, atau mencantumkan semua dependensi yang terkait dengan versi tertentu.
Konsol
Untuk mencantumkan dependensi:
Di konsol Google Cloud, buka halaman Supply chain di API hub.
Daftar dependensi yang diketahui akan muncul di halaman Supply chain.
Di kolom Filter, jika diperlukan, tentukan operasi
pemasok dan/atau konsumen untuk menampilkan dependensi yang relevan. Fitur filter memungkinkan Anda menemukan semua dependensi yang ditautkan dengan operasi yang ditentukan.
Bagian ini menjelaskan cara mendapatkan detail tentang dependensi API dengan REST API. Anda dapat
melihat detail konsumen dan pemasok, serta melihat detail tentang dependensi termasuk error
yang dapat menunjukkan, misalnya, dependensi yang rusak.
Konsol
Untuk mendapatkan dependensi:
Di konsol Google Cloud, buka halaman Supply chain di API hub.
Di kolom Filter, jika diperlukan, tentukan operasi
pemasok dan/atau konsumen untuk menampilkan dependensi yang relevan. Fitur filter memungkinkan Anda menemukan semua dependensi yang ditautkan dengan operasi yang ditentukan.
Temukan dependensi yang diinginkan, lalu klik Lihat Detail.
Di kolom Filter, jika diperlukan, tentukan operasi
pemasok dan/atau konsumen untuk menampilkan dependensi yang relevan. Fitur filter memungkinkan Anda menemukan semua dependensi yang ditautkan dengan operasi yang ditentukan.
Temukan dependensi yang diinginkan, lalu klik ikon hapus untuk menghapus dependensi tersebut.
REST
Untuk menghapus dependensi dari API hub, gunakan Delete dependency API:
Di kolom Filter, jika diperlukan, tentukan operasi
pemasok dan/atau konsumen untuk menampilkan dependensi yang relevan. Fitur filter memungkinkan Anda menemukan semua dependensi yang ditautkan dengan operasi
yang ditentukan.
Temukan dependensi yang diinginkan, lalu klik Lihat Detail.
Di halaman Dependensi, Anda dapat mengedit deskripsi dan atribut. Gunakan ikon
edit untuk mengaktifkan pengeditan pada kolom tersebut.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-09-03 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."]]