Querying the Unique Service or Schema ID of a Microservice
Function
This API is used to query the unique service or schema ID of a microservice based on filter criteria.
URI
GET /v4/{project_id}/registry/existence
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Fixed value: default. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
type |
Yes |
String |
Request type.
NOTE:
|
env |
No |
String |
Microservice environment. Value: development, testing, acceptance, or production. |
appId |
Yes |
String |
Application ID, which needs to be transferred when the resource type is microservice. 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 |
Yes |
String |
Microservice name, which needs to be transferred when the resource type is microservice. 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 |
Yes |
String |
Microservice version, which needs to be transferred when the resource type is microservice. The value contains 1 to 64 characters. Regular expression: ^[0-9]$|^[0-9]+(.[0-9]+)$ |
serviceId |
Yes |
String |
Microservice ID, which needs to be transferred when the resource type is schema. The value contains 1 to 64 characters. Regular expression: ^.*$ |
schemaId |
Yes |
String |
Schema ID, which needs to be transferred when the resource type is schema. The value contains 1 to 160 characters. Regular expression: ^[a-zA-Z0-9]{1,160}$|^[a-zA-Z0-9][a-zA-Z0-9_-.]{0,158}[a-zA-Z0-9]$. |
Request
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
Parameter |
Type |
Description |
---|---|---|
X-Schema-Summary |
String |
Summary of a microservice schema. |
Parameter |
Type |
Description |
---|---|---|
serviceId |
String |
When a service is queried, a service ID is returned. |
schemaId |
String |
When a schema is queried, a schema ID is returned. |
Status code: 400
Parameter |
Type |
Description |
---|---|---|
errorCode |
String |
Error code. |
errorMessage |
String |
Error message. |
detail |
String |
Location details. |
Status code: 500
Parameter |
Type |
Description |
---|---|---|
errorCode |
String |
Error code. |
errorMessage |
String |
Error message. |
detail |
String |
Location details. |
Example Request
Query serviceId based on microservice as type, default as appId, service as serviceName, and 1.0.0 as version.
GET https://{endpoint}/v4/{project_id}/registry/existence?type=microservice&appId=default&serviceName=service&version=1.0.0
Example Response
Status code: 200
Successfully queried. serviceId or schemaId is returned.
{ "serviceId" : "8aed80ea052ac04a64dfc79c24f2170224d074f5" }
Status Code
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
500 |
Internal Server Error |
Error Code
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot