Help Center/ ServiceStage/ API Reference/ ServiceComb APIs/ Microservice/ Querying Information About All Microservices
Updated on 2024-10-16 GMT+08:00

Querying Information About All Microservices

Function

This API is used to query definition information about microservices that meet filter criteria.

Restrictions

None

URI

GET /v4/{project_id}/registry/microservices

Table 1 Path parameter

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.

Request

Table 2 Request header parameter

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.

Response

Status code: 200

Table 3 Response body parameter

Parameter

Type

Description

services

Array of MicroService objects

Microservice list.

Table 4 MicroService

Parameter

Type

Description

serviceId

String

Microservice ID, which must be unique. The value contains 1 to 64 characters. Regular expression: ^.*$

environment

String

Microservice environment. Value: development, testing, acceptance, or production. You can use the API for uploading schemas in batches to add or modify an existing schema only when the value is development, testing, or acceptance. Default value: development.

appId

String

Application ID, which must be unique. The value contains 1 to 160 characters. Regular expression: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9_-.][a-zA-Z0-9]$

serviceName

String

Microservice name, which must be unique in an application. The value contains 1 to 128 characters. Regular expression: ^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9_-.][a-zA-Z0-9]$

version

String

Microservice version. The value contains 1 to 64 characters. Regular expression: ^[0-9]$|^[0-9]+(.[0-9]+)$

description

String

Microservice description. The value contains a maximum of 256 characters.

level

String

Microservice level. Value: FRONT, MIDDLE, or BACK.

registerBy

String

Microservice registration mode. Value: SDK, PLATFORM, SIDECAR, or UNKNOWN.

schemas

Array of strings

Microservice schema content. The value must be 1 to 160 bytes long. Only digits, letters, underscores (_), hyphens (-), and periods (.) are allowed. An array contains a maximum of 100 schemas.

status

String

Microservice status. Value: UP or DOWN. Default value: UP.

timestamp

String

Microservice registration time.

modTimestamp

String

Latest modification time (UTC).

framework

Framework object

Development framework.

paths

Array of ServicePath objects

Service path.

Table 5 Framework

Parameter

Type

Description

name

String

Microservice development framework. Default value: UNKNOWN.

version

String

Version of the microservice development framework.

Table 6 ServicePath

Parameter

Type

Description

Path

String

Route address.

Property

Object

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

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

errorMessage

String

Error message.

detail

String

Location details.

Status code: 500

Table 8 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

errorMessage

String

Error message.

detail

String

Location details.

Example Request

Query information about all registered microservices.

GET https://{endpoint}/v4/{project_id}/registry/microservices

Example Response

Status code: 200

Successfully queried.

{
    "services": [
        {
            "serviceId": "8aed80ea052ac04a64dfc79c24f2170224d074f5",
            "appId": "default",
            "serviceName": "test",
            "version": "1.0.0",
            "description": "this is a test",
            "level": "BACK",
            "status": "UP",
            "timestamp": "1650543950",
            "modTimestamp": "1650543950"
        },
        {
            "serviceId": "dcc6c1073eab3cadb47cea2e1a874b7883b02a63",
            "appId": "test",
            "serviceName": "test1",
            "version": "1.0.0",
            "level": "BACK",
            "status": "UP",
            "timestamp": "1650544223",
            "modTimestamp": "1650544223"
        }
    ]
}

Status Code

Status Code

Description

200

OK

400

Bad Request

500

Internal Server Error

Error Code

See ServiceComb Error Codes.