Help Center> ServiceStage> API Reference> Out-of-Date APIs> Creating a Dependency Between Services
Updated on 2023-07-19 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

See "Microservice Management" in API Calling.

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 parameters

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 ServiceStage Error Codes.