Create API supply chain dependencies Stay organized with collections Save and categorize content based on your preferences.
This pageapplies toApigee andApigee hybrid.
You can create a dependency between APIs, API versions, and API operations in API hub. The high-level process to create a dependency is as follows:
- Find two APIs that may have operations that may be dependent. The operations may be inregistered APIs orexternal APIs.
- Determine which API is the supplier and which is the consumer. As discussed previously, the consumer invokes the supplier.
- Use the Google Cloud console or theCreate dependency API to create the dependency between the supplier and consumer.
Create a dependency
You can create a dependency in the console or with the REST API.
Console
To create a dependency using the Google Cloud console, do the following:
In the Google Cloud console, go to theAPI supply chain page inAPI hub.
Go to API hub- ClickCreate dependency and provide the following inputs in theCreate a new dependency page.
- UnderGeneral details, do the following:
- Specify unique ID: (Optional) The identifier of the dependency. If not provided, a system-generated ID will be used.Note: Dependency ID must be 4-500 characters long and can contain only uppercase letters (A-Z), lowercase letters (a-z), numbers (0-9), and hyphens (-). The ID forms the last part of the API resource name:
projects/PROJECT/locations/LOCATION/dependencies/DEPENDENCY_ID. - Description: (Optional) A brief description of the dependency.
- ClickContinue.
- Specify unique ID: (Optional) The identifier of the dependency. If not provided, a system-generated ID will be used.Note: Dependency ID must be 4-500 characters long and can contain only uppercase letters (A-Z), lowercase letters (a-z), numbers (0-9), and hyphens (-). The ID forms the last part of the API resource name:
- UnderSelect supplier resource, do the following:
- Resource type: SelectOperation as the supplier resource type.
- Supplier API: Select the API that supplies the operation.
- Version: Select the API version of the supplier API that provides the operation.
- Operation: Select the operation that is supplied to the consumer. For example:
GET-/items. - ClickContinue. Note:To use external APIs to create dependencies, you must use theDependencies API. For more information, see theREST API tab.
- UnderSelect consumer resource, do the following:
- Resource type: SelectOperation as the consumer resource type.
- Consumer API: Select the API that consumes the operation.
- Version: Select the API version of the consumer API that consumes the operation.
- Operation: Select the operation that is consumed by the supplier. For example:
GET-/categories. - ClickContinue.
- Optionally, provide values for any user-defined attributes that were defined in Settings.
- ClickCreate. The new dependency appears in theAPI supply chain page.
REST API
To create a new dependency using theCreate a dependency API, use the following command:
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" } }'Replace the following:
- HUB_PROJECT: The name of your API hub host project. The host project was selected when API hub was provisioned.
- HUB_LOCATION: The location of the host project. The location was chosen when API hub was provisioned.
- DEPENDENCY_ID: (Optional) The identifier of the dependency. If not provided, a system-generated ID will be used.Note: The ID must be 4-500 characters, and valid characters are
/[A-Z][a-z][0-9]-/.The ID is the last component of the fully qualified, unique API resource name, which is in the format:projects/PROJECT/locations/LOCATION/dependencies/DEPENDENCY_ID - DESCRIPTION: (Optional) A brief description of the dependency.
RESOURCE_NAME: (Required) Either the resource name of an operation in API hub or an external API, depending on which attribute you specify.
Operation resource names follow this format:
projects/PROJECT/locations/LOCATION/apis/API/versions/VERSION/operations/OPERATIONOperation resource example:
"projects/myproject/locations/us-central1/apis/payments-api/versions/locationv1/operations/getlocation".External API resource names follow this format:
projects/PROJECT/locations/LOCATION/externalApis/EXTERNAL_APIExternal API resource example:
"projects/myproject/locations/us-central1/externalApis/petstore".
Example:
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" } }'Sample response:
{ "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" }What's next?
- Learn about how tomanage dependencies.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-15 UTC.