Help Center/ ServiceStage/ API Reference/ ServiceComb APIs/ Microservice Instance/ Modifying the Extended Information About a Microservice Instance
Updated on 2024-10-16 GMT+08:00

Modifying the Extended Information About a Microservice Instance

Function

This API is used to add or update the extended information about a microservice instance based on instance_id after the instance is registered.

Restrictions

None

URI

PUT /v4/{project_id}/registry/microservices/{service_id}/instances/{instance_id}/properties

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

  • For a professional microservice engine, enter the tenant project ID. The value contains 1 to 64 characters. See Obtaining a Project ID. You can also enter the fixed value default.
  • For an exclusive microservice engine, enter the fixed value default.

service_id

Yes

String

Microservice ID, which must be unique. The value contains 1 to 64 characters. Regular expression: ^.*$. See Querying Information About All Microservices.

instance_id

Yes

String

Microservice instance ID, which must be unique. The value contains 1 to 64 characters. Regular expression: ^[A-Za-z0-9_.-]*$. See Querying a Microservice Instance Based on service_id.

Request

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Authorization

No

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.

X-consumerId

No

String

Microservice consumer ID, which must be unique.

Table 3 Request body parameter

Parameter

Mandatory

Type

Description

properties

No

Object

Extended attribute. You can customize a key and value. The value must be at least 1 byte long.

Response

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

errorMessage

String

Error message.

detail

String

Location details.

Status code: 500

Table 5 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

errorMessage

String

Error message.

detail

String

Location details.

Example Request

Update the extended information of an instance with specified instance_id to "attr1": "b".

PUT https://{endpoint}/v4/{project_id}/registry/microservices/{service_id}/instances/{instance_id}/properties

{
  "properties" : {
    "attr1" : "b"
  }
}

Example Response

None

Status Code

Status Code

Description

200

OK

400

Bad Request

500

Internal Server Error

Error Code

See ServiceComb Error Codes.