查询微服务唯一标识信息
功能介绍
可通过指定条件,查询微服务serviceId或schema的唯一标识信息。
URI
GET /v4/{project_id}/registry/existence
| 
        参数  | 
      
        是否必选  | 
      
        参数类型  | 
      
        描述  | 
     
|---|---|---|---|
| 
        project_id  | 
      
        是  | 
      
        String  | 
      
        请填固定值:default。  | 
     
| 
        参数  | 
      
        是否必选  | 
      
        参数类型  | 
      
        描述  | 
     
|---|---|---|---|
| 
        type  | 
      
        是  | 
      
        String  | 
      
        请求类型: 
 
         说明: 
         
  | 
     
| 
        env  | 
      
        否  | 
      
        String  | 
      
        微服务的环境信息:development、testing、acceptance、production。  | 
     
| 
        appId  | 
      
        是  | 
      
        String  | 
      
        资源类型为microservice时需传入应用app唯一标识。 字符长度为1~160。正则表达式为^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9_-.][a-zA-Z0-9]$。  | 
     
| 
        serviceName  | 
      
        是  | 
      
        String  | 
      
        资源类型为microservice时需传入微服务名称。 字符长度为1~128正则表达式为^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9_-.][a-zA-Z0-9]$。  | 
     
| 
        version  | 
      
        是  | 
      
        String  | 
      
        资源类型为microservice时需传入微服务版本。 字符长度为1~64。正则表达式为^[0-9]$|^[0-9]+(.[0-9]+)$。  | 
     
| 
        serviceId  | 
      
        是  | 
      
        String  | 
      
        资源类型为schema时需传入微服务唯一标识。 字符长度为1~64。正则表达式为^.*$。  | 
     
| 
        schemaId  | 
      
        是  | 
      
        String  | 
      
        资源类型为schema时需传入schema唯一标识。 字符长度为1~160。正则表达式为^[a-zA-Z0-9]{1,160}$|^[a-zA-Z0-9][a-zA-Z0-9_-.]{0,158}[a-zA-Z0-9]$。  | 
     
请求参数
| 
        参数  | 
      
        是否必选  | 
      
        参数类型  | 
      
        描述  | 
     
|---|---|---|---|
| 
        Authorization  | 
      
        否  | 
      
        String  | 
      
        若ServiceComb引擎专享版开启了安全认证,此参数必填。否则,无此参数。 开启了安全认证的ServiceComb引擎专享版Token,格式为: Authorization:Bearer {Token}
       Token获取方法,请参考获取ServiceComb引擎专享版用户Token。  | 
     
响应参数
状态码: 200
| 
        参数  | 
      
        参数类型  | 
      
        描述  | 
     
|---|---|---|
| 
        X-Schema-Summary  | 
      
        String  | 
      
        契约的摘要。  | 
     
| 
        参数  | 
      
        参数类型  | 
      
        描述  | 
     
|---|---|---|
| 
        serviceId  | 
      
        String  | 
      
        查询实体为服务时,返回服务ID。  | 
     
| 
        schemaId  | 
      
        String  | 
      
        查询实体为契约时,返回契约ID。  | 
     
状态码: 400
| 
        参数  | 
      
        参数类型  | 
      
        描述  | 
     
|---|---|---|
| 
        errorCode  | 
      
        String  | 
      
        错误代码。  | 
     
| 
        errorMessage  | 
      
        String  | 
      
        错误信息。  | 
     
| 
        detail  | 
      
        String  | 
      
        详细定位信息。  | 
     
状态码: 500
| 
        参数  | 
      
        参数类型  | 
      
        描述  | 
     
|---|---|---|
| 
        errorCode  | 
      
        String  | 
      
        错误代码。  | 
     
| 
        errorMessage  | 
      
        String  | 
      
        错误信息。  | 
     
| 
        detail  | 
      
        String  | 
      
        详细定位信息。  | 
     
请求示例
查询微服务serviceId,指定的查询条件是请求类型为microservice,应用id为default,微服务名称为service,微服务版本为1.0.0。
GET https://{endpoint}/v4/{project_id}/registry/existence?type=microservice&appId=default&serviceName=service&version=1.0.0
 响应示例
状态码: 200
查询成功,则返回serviceId或者schemaId。
{
  "serviceId" : "8aed80ea052ac04a64dfc79c24f2170224d074f5"
}
 状态码
| 
        状态码  | 
      
        描述  | 
     
|---|---|
| 
        200  | 
      
        查询成功。  | 
     
| 
        400  | 
      
        错误的请求。  | 
     
| 
        500  | 
      
        服务内部错误。  | 
     
错误码
请参见ServiceComb错误码。