本文介绍自学习(viapi-regen)类目下的获取服务GetService的语法及示例。
功能描述
通过服务ID,查看服务详情。
- 您可以进入在线咨询获取在线人工帮助。
- 阿里云视觉智能开放平台视觉AI能力API接入、接口使用或问题咨询等,请通过钉钉群(23109592)加入阿里云视觉智能开放平台咨询群联系我们。
接入指引
1. 注册阿里云账号:打开阿里云官网,在阿里云官网右上角,单击立即注册,按照操作提示完成账号注册。
2. 开通能力:请确保您已开通自学习服务,若未开通服务请立即开通。
3. 创建AccessKey:请确保您已创建AccessKey,如果您使用的是子账号AccessKey,您需要给子账号赋予AliyunVIAPIFullAccess权限,具体操作,请参见RAM授权。
4. 在线调试(可选):您可以通过OpenAPI Explorer在线调试能力,查看完整的调用示例代码及SDK依赖信息,也可以下载完整的工程。
5. 开发接入步骤:
- 在SDK总览中选择您要接入使用的SDK语言。
- 在对应语言的SDK文档中找到AI类目为自学习(viapi-regen)类目的SDK包进行安装。
- 参考文档中提供的示例代码进行适当修改后调用。
6. 客户端直接调用:该能力常用的客户端调用方式包括以下几种。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 |
类型 |
是否必选 |
示例值 |
描述 |
Action | String | 是 | GetService | 系统规定参数。取值:GetService。 |
Id | Long | 是 | 4 | 服务ID,用以标识唯一服务。 |
返回数据
名称 |
类型 |
示例值 |
描述 |
RequestId | String | BAFD3138-AF5B-0193-A155-32C16CA895AE | 每个请求分配唯一的服务器请求ID。 |
Data | Object | 出参数据实体。 |
|
Id | Long | 4 | 服务ID。 |
GmtCreate | Long | 1631505139000 | 创建时间。 |
ServiceName | String | QSL测试 | 服务名称。 |
ServiceDescription | String | SQL测试描述 | 服务描述。 |
Status | String | INIT | 服务当前状态,服务状态取值如下:
|
ServiceId | String | b66e91b46a05afa3b07c4dcaafb9**** | 接口鉴权密钥。 |
InputParams | String | [{"name": "requestId", "desc": "请求ID,用于问题排查", "example": "D6319603-9DD1-45ae-950E-FCA36EB6DFA7"}, {"name": "imageUrl", "desc": "需要传上海OSS内网地址", "example": "https://viapi-test.oss-cn-shanghai-internal.aliyuncs.com/regen/test.jpeg"}] | 入参。 |
OutputParams | String | [{"name": "category", "desc": "分类", "example": "black"}, {"name": "score", "desc": "置信度", "example": "0.8801174759864807"}] | 出参。 |
Errorcodes | String | [{"errorcode": "0", "errormessage": "success", "description": "成功"}, {"errorcode": "401", "errormessage": "parse json error", "description": "解析输入的json出错"}, {"errorcode": "402", "errormessage": "download data error", "description": "下载图片出错"}, {"errorcode": "500", "errormessage": "pre processing error", "description": "算法前处理错误"}, {"errorcode": "501", "errormessage": "inference error", "description": "算法推理错误"}, {"errorcode": "502", "errormessage": "post processing error", "description": "算法后处理错误"}] | 错误码。 |
InputExample | String | {"requestId": "D6319603-9DD1-45ae-950E-FCA36EB6DFA7", "imageUrl":"https://viapi-test.oss-cn-shanghai-internal.aliyuncs.com/regen/test.jpeg"} | 入参示例。 |
OutputExample | String | {"right": "{'requestId': 'D6319603-9DD1-45ae-950E-FCA36EB6DFA7', 'data': {'category': 'black', 'score': 0.8801174759864807}, 'errorcode': '0', 'errormessage': 'success'}", "wrong": "{'requestId': 'D6319603-9DD1-45ae-950E-FCA36EB6DFA7', 'errorcode': '402', 'errormessage': 'download data error'}" | 出参示例。 |
DataReflowInfo | Object | 数据回流信息。 |
|
DataReflowCount | Long | 193 | 当前服务回流数据总量。 |
DataReflowRate | Long | 100 | 数据回流率。 |
DataReflowOssPath | String | oss://regen-test-bucket/jhdtest/检测/回流2/ | 数据回流路径。 |
EnableDataReflowFlag | Boolean | true | 数据回流开关标识。 |
SDK参考
阿里云视觉AI自学习类目下的获取服务能力推荐使用SDK调用,支持多种编程语言,调用时请选择AI类目为自学习(viapi-regen)的SDK包,文件参数通过SDK调用可支持本地文件及任意URL,具体可参见SDK总览。
示例
请求示例
http(s)://viapi-regen.cn-shanghai.aliyuncs.com/?Action=GetService //更多关于访问域名(Endpoint)信息,请参见:https://help.aliyun.com/document_detail/143103.html
&Id=4
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<GetServiceResponse>
<RequestId>BAFD3138-AF5B-0193-A155-32C16CA895AE</RequestId>
<Data>
<Id>4</Id>
<GmtCreate>1631505139000</GmtCreate>
<ServiceName>QSL测试</ServiceName>
<ServiceDescription>SQL测试描述</ServiceDescription>
<Status>INIT</Status>
<ServiceId>b66e91b46a05afa3b07c4dcaafb9****</ServiceId>
<InputParams>[{"name": "requestId", "desc": "请求ID,用于问题排查", "example": "D6319603-9DD1-45ae-950E-FCA36EB6DFA7"}, {"name": "imageUrl", "desc": "需要传上海OSS内网地址", "example": "https://viapi-test.oss-cn-shanghai-internal.aliyuncs.com/regen/test.jpeg"}]</InputParams>
<OutputParams>[{"name": "category", "desc": "分类", "example": "black"}, {"name": "score", "desc": "置信度", "example": "0.8801174759864807"}]</OutputParams>
<Errorcodes>[{"errorcode": "0", "errormessage": "success", "description": "成功"}, {"errorcode": "401", "errormessage": "parse json error", "description": "解析输入的json出错"}, {"errorcode": "402", "errormessage": "download data error", "description": "下载图片出错"}, {"errorcode": "500", "errormessage": "pre processing error", "description": "算法前处理错误"}, {"errorcode": "501", "errormessage": "inference error", "description": "算法推理错误"}, {"errorcode": "502", "errormessage": "post processing error", "description": "算法后处理错误"}]</Errorcodes>
<InputExample>{"requestId": "D6319603-9DD1-45ae-950E-FCA36EB6DFA7", "imageUrl":"https://viapi-test.oss-cn-shanghai-internal.aliyuncs.com/regen/test.jpeg"}</InputExample>
<OutputExample>{"right": "{'requestId': 'D6319603-9DD1-45ae-950E-FCA36EB6DFA7', 'data': {'category': 'black', 'score': 0.8801174759864807}, 'errorcode': '0', 'errormessage': 'success'}", "wrong": "{'requestId': 'D6319603-9DD1-45ae-950E-FCA36EB6DFA7', 'errorcode': '402', 'errormessage': 'download data error'}"</OutputExample>
<DataReflowInfo>
<DataReflowCount>193</DataReflowCount>
<DataReflowRate>100</DataReflowRate>
<DataReflowOssPath>oss://regen-test-bucket/jhdtest/检测/回流2/</DataReflowOssPath>
<EnableDataReflowFlag>true</EnableDataReflowFlag>
</DataReflowInfo>
</Data>
</GetServiceResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "BAFD3138-AF5B-0193-A155-32C16CA895AE",
"Data" : {
"Id" : 4,
"GmtCreate" : 1631505139000,
"ServiceName" : "QSL测试",
"ServiceDescription" : "SQL测试描述",
"Status" : "INIT",
"ServiceId" : "b66e91b46a05afa3b07c4dcaafb9****",
"InputParams" : "[{\"name\": \"requestId\", \"desc\": \"请求ID,用于问题排查\", \"example\": \"D6319603-9DD1-45ae-950E-FCA36EB6DFA7\"}, {\"name\": \"imageUrl\", \"desc\": \"需要传上海OSS内网地址\", \"example\": \"https://viapi-test.oss-cn-shanghai-internal.aliyuncs.com/regen/test.jpeg\"}]",
"OutputParams" : "[{\"name\": \"category\", \"desc\": \"分类\", \"example\": \"black\"}, {\"name\": \"score\", \"desc\": \"置信度\", \"example\": \"0.8801174759864807\"}]",
"Errorcodes" : "[{\"errorcode\": \"0\", \"errormessage\": \"success\", \"description\": \"成功\"}, {\"errorcode\": \"401\", \"errormessage\": \"parse json error\", \"description\": \"解析输入的json出错\"}, {\"errorcode\": \"402\", \"errormessage\": \"download data error\", \"description\": \"下载图片出错\"}, {\"errorcode\": \"500\", \"errormessage\": \"pre processing error\", \"description\": \"算法前处理错误\"}, {\"errorcode\": \"501\", \"errormessage\": \"inference error\", \"description\": \"算法推理错误\"}, {\"errorcode\": \"502\", \"errormessage\": \"post processing error\", \"description\": \"算法后处理错误\"}]",
"InputExample" : "{\"requestId\": \"D6319603-9DD1-45ae-950E-FCA36EB6DFA7\", \"imageUrl\":\"https://viapi-test.oss-cn-shanghai-internal.aliyuncs.com/regen/test.jpeg\"}",
"OutputExample" : "{\"right\": \"{'requestId': 'D6319603-9DD1-45ae-950E-FCA36EB6DFA7', 'data': {'category': 'black', 'score': 0.8801174759864807}, 'errorcode': '0', 'errormessage': 'success'}\", \"wrong\": \"{'requestId': 'D6319603-9DD1-45ae-950E-FCA36EB6DFA7', 'errorcode': '402', 'errormessage': 'download data error'}\"",
"DataReflowInfo" : {
"DataReflowCount" : 193,
"DataReflowRate" : 100,
"DataReflowOssPath" : "oss://regen-test-bucket/jhdtest/检测/回流2/",
"EnableDataReflowFlag" : true
}
}
}
错误码
关于获取服务的错误码,详情请参见常见错误码。
安全声明
- 请确保上传的图片或文件来源符合相应的法律法规。
- 通过体验调试上传的临时文件有效期为1小时,在24小时后会被系统自动清理删除。