Help Center/ ServiceStage/ API Reference/ Historical APIs/ Creating a Dependency Between Services
Updated on 2024-12-16 GMT+08:00

Creating a Dependency Between Services

Function

This API is used to create a dependency between services. For consumer, version must be a confirmed version and serviceName cannot be *. consumer must be an existing service while provider can be a service that has not been created.

Call Method

  1. Log in to ServiceStage and choose Cloud Service Engine > Engines.
  2. Select the target microservice engine from the Microservice Engine drop-down list in the upper part of the page.
  3. In the Service Discovery and Configuration area, view or click to copy the service center address.
  4. Call the API by referring to Calling APIs. In Request URI, replace {Endpoint} with the obtained service center address.

URI

PUT /v4/{project_id}/registry/dependencies

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Fixed value: default.

Request

Table 2 Request header parameter

Parameter

Mandatory

Type

Description

Authorization

Yes

String

This parameter is mandatory if security authentication is enabled for an exclusive microservice engine. Otherwise, this parameter is not required.

The token of an exclusive microservice engine with security authentication enabled is in the following format:

Authorization:Bearer {Token}

For details about how to obtain the token, see Obtaining the User Token of an Exclusive Microservice Engine.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

dependencies

Yes

Arrayof objects

Set of rules. See Table 4. The array can contain 1–100 objects.

Table 4 MicroServiceDependency

Parameter

Mandatory

Type

Description

consumer

Yes

Object

Consumer microservice. See DependencyMicroService.

providers

No

Array of objects

Provider microservice. See DependencyMicroService.

Response

None

Example Request

{
  "dependencies": [
    {
      "consumer": {
        "environment": "",
          "appId": "default",
          "serviceName": "test1",
          "version": "1.0.0"
      },
      "providers": [
        {
          "environment": "",
          "appId": "default",
          "serviceName": "test",
          "version": "1.0.0"
        }
      ]
    }
  ]
}

Example Response

None

Status Code

See Status Codes.

Error Code

See CSE Error Codes.