Help Center/ ServiceStage/ API Reference (Kuala Lumpur Region)/ CSE API/ Querying a Microservice Instance by Filter Criteria
Updated on 2023-06-26 GMT+08:00

Querying a Microservice Instance by Filter Criteria

Function

This API is used to query a microservice instance based on microservice version rules or field filter criteria after the instance is registered.

URI

GET /v4/{project_id}/registry/instances

Table 1 Path parameters

Parameter

Type

Mandatory

Description

project_id

String

Yes

Fixed value: default.

Table 2 Query parameters

Parameter

Type

Mandatory

Description

appId

String

Yes

Application ID, which must be unique.

The value must be 1 to 160 characters long.

Regular expression: ^[a-zA-Z0-9]*$|^[a-zA-Z0-9][a-zA-Z0-9_\-.]*[a-zA-Z0-9]$

serviceName

String

Yes

Microservice name.

The value must be 1 to 128 characters long.

Regular expression: ^[a-zA-Z0-9]*$|^[a-zA-Z0-9][a-zA-Z0-9_\-.]*[a-zA-Z0-9]$

version

String

Yes

Version rule. Options:
  • 1: exact version matching. Example: 0.0.1.
  • 2: subsequent version matching. Example: 0.0.1+.
  • 3: latest version. Example: latest.
  • 4: version range. Example: 0.1.0–0.2.0.

env

String

No

Value: development, testing, acceptance, or production.

tags

String

No

Tag for filtering services. When there are multiple tags, separate them using commas (,).

Regular expression: ^[a-zA-Z][a-zA-Z0-9_\-\.]{0,63}$

Request

Table 3 Request header parameter

Parameter

Type

Mandatory

Description

X-ConsumerId

String

No

Unique ID of a service consumer.

Response

Response parameters

Table 4 describes the parameters.

Table 4 Parameter

Parameter

Type

Description

instances

Array of objects

Set of microservice instances. Each item in the array is an instance. For details, see MicroServiceInstance.

Example

Example request

GET /v4/default/registry/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.