Help Center/ ServiceStage/ API Reference/ ServiceComb APIs/ Microservice/ Querying Information About a Microservice
Updated on 2024-11-27 GMT+08:00

Querying Information About a Microservice

Function

This API is used to query the definition information about a microservice based on service_id.

Restrictions

None

URI

GET /v4/{project_id}/registry/microservices/{service_id}

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.

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

service

MicroService object

Microservice information.

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.

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.

Value:

  • UP
  • DOWN

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 details about the microservice whose ID is 819706e21b7173306797d19922ce4231441c17c5.

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

Example Response

Status code: 200

Successfully queried.

{
    "service": {
        "serviceId": "819706e21b7173306797d19922ce4231441c17c5",
        "appId": "default",
        "serviceName": "SERVICECENTER",
        "version": "2.4.8",
        "level": "BACK",
        "schemas": [
            "servicecenter.grpc.api.ServiceCtrl",
            "servicecenter.grpc.api.ServiceInstanceCtrl"
        ],
        "status": "UP",
        "timestamp": "1616426688",
        "modTimestamp": "1616426688",
        "environment": "development"
    }
}

Status Code

Status Code

Description

200

OK

400

Bad Request

500

Internal Server Error

Error Code

See ServiceComb Error Codes.