Updated on 2023-11-08 GMT+08:00

Querying a Microservice Schema

Function

Query a microservice schema based on service_id and schema_id.

Restrictions

None

URI

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

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

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.

schema_id

Yes

String

Schema ID. See Querying All Schema Information About a Microservice.

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 ServiceComb engine. Otherwise, this parameter is not required.

The token of an exclusive ServiceComb 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 ServiceComb Engine.

Response

Status code: 200

Table 3 Response header parameter

Parameter

Type

Description

X-Schema-Summary

String

Schema summary.

Table 4 Response body parameter

Parameter

Type

Description

schema

String

Schema content.

Status code: 400

Table 5 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

errorMessage

String

Error message.

detail

String

Location details.

Status code: 500

Table 6 Response body parameters

Parameter

Type

Description

errorCode

String

Error code.

errorMessage

String

Error message.

detail

String

Location details.

Example Request

Query details about a schema with specified service_id and schema_id.

GET https://{endpoint}/v4/{project_id}/registry/microservices/{service_id}/schemas/{schema_id}

Example Response

Status code: 200

Successfully queried. If the summary exists, the value of X-Schema-Summary in the header is the summary of the schema.

{
  "schema" : "---\nswagger: \"2.0\"\ninfo:\n  version: \"1.0.0\"\n  title: \"swagger definition for com.service.provider.controller.ProviderImpl\"\n  x-java-interface: \"cse.gen.springmvc.provider.provider.ProviderImplIntf\"\nbasePath: \"/provider\"\nconsumes:\n- \"application/json\"\nproduces:\n- \"application/json\"\npaths:\n  /helloworld:\n    get:\n      operationId: \"helloworld\"\n      produces:\n      - \"application/json\"\n      parameters:\n      - name: \"name\"\n        in: \"query\"\n        required: true\n        type: \"string\"\n      responses:\n        200:\n          description: \"response of 200\"\n          schema:\n            type: \"string\"\n"
}

Status Code

Status Code

Description

200

OK

400

Bad Request

500

Internal Server Error

Error Code

See ServiceComb Error Codes.