Help Center/ ServiceStage/ API Reference (Kuala Lumpur Region)/ CSE API/ Querying All Instances of a Microservice Based on the Service ID
Updated on 2023-06-26 GMT+08:00

Querying All Instances of a Microservice Based on the Service ID

Function

This API is used to query all instances of a microservice based on the service ID after the instances are registered.

URI

GET /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

Table 2 Request header parameter

Parameter

Type

Mandatory

Description

X-ConsumerId

String

No

Unique ID of a service consumer.

Response

Response parameters

Table 3 Parameter

Parameter

Type

Description

instances

Array of objects

Set of microservice instances. For details, see MicroServiceInstance.

Example

Example request

GET /v4/default/registry/microservices/e0f0da073f2c91e8979a89ff2d7c69t6/instances

Example response

{
  "instances": [
    {
      "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"
    }
  ]
}

Status Code

See Status Codes.

Error Code

See CSE Error Codes.