Help Center> ServiceStage> API Reference (Kuala Lumpur Region)> CSE API> Registering a Microservice Instance
Updated on 2023-06-26 GMT+08:00

Registering a Microservice Instance

Function

This API is used to register a microservice instance after static microservice information is created. Information about the instance must be provided during registration.

The instance ID can be customized. If a customized instance ID is available, use it for registration. If it is not available, the system automatically generates an instance ID.

URI

POST /v4/{project_id}/registry/microservices/{serviceId}/instances

Table 1 Path parameters

Parameter

Type

Mandatory

Description

project_id

String

Yes

Fixed value: default.

serviceId

String

Yes

Microservice ID, which must be unique.

The value must be 1 to 64 characters long.

Regular expression: ^.*$

Request

Request parameters

Table 2 Parameter

Parameter

Type

Mandatory

Description

instance

Object

Yes

Microservice instance struct. For details, see MicroServiceInstance.

Response

Response parameters

Table 3 describes the parameters.

Table 3 Parameter

Parameter

Type

Description

instanceId

String

Microservice instance ID, which must be unique.

Example

Example request

{
  "instance": {
    "instanceId": "string",
    "serviceId": "string",
    "version": "string",
    "hostName": "string",
    "endpoints": [
      "string"
    ],
    "status": "string",
    "healthCheck": {
      "mode": "string",
      "port": 0,
      "interval": 0,
      "times": 0
    },
    "dataCenterInfo": {
      "name": "string",
      "region": "string",
      "availableZone": "string"
    },
    "timestamp": "string",
    "modTimestamp": "string"
  }
}

Example response

{
  "instanceId": "string"
}

Status Code

See Status Codes.

Error Code

See CSE Error Codes.