本文为您介绍SearchByName接口的语法及示例,用于根据名称查询图像搜索实例中的图片信息。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 | 类型 | 是否必选 | 示例值 | 描述 |
---|---|---|---|---|
InstanceName | String | 是 | demoinstance1 |
图像搜索实例名称。 |
ProductId | String | 是 | 2092061_1 |
商品ID。 |
PicName | String | 是 | 2092061_1.jpg |
图片名称。 |
CategoryId | Integer | 否 | 88888888 |
商品类目。具体请参见类目参考。
|
Num | Integer | 否 | 10 |
返回结果的数目。取值范围:1~100。默认值为10。 |
Start | Integer | 否 | 0 |
返回结果的起始位置。取值范围:0~499。默认值为0。 |
Filter | String | 否 | int_attr>=100 |
过滤条件。int_attr支持的操作符有>、>=、<、<=、=。str_attr支持的操作符有=和!=,多个条件之支持AND和OR进行连接。例如:int_attr>=100、str_attr!=”value1”、int_attr=1000 AND str_attr=”value1”。 |
返回数据
名称 | 类型 | 示例值 | 描述 |
---|---|---|---|
Msg | String | success |
错误信息。 |
Head | object |
搜索结果概述信息。 |
|
DocsFound | Integer | 10 |
返回结果数目。 |
DocsReturn | Integer | 10000 |
实例中命中结果数目。 |
SearchTime | Integer | 95 |
搜索耗时,单位毫秒。 |
RequestId | String | 36C43E96-8F68-44AA-B1AF-B1F7AB94A6C1 |
请求ID。 |
Auctions | Array of Auction |
所有返回的商品描述信息。 |
|
PicName | String | 2092061_1.jpg |
图片名称。 |
IntAttr | Integer | 2 |
整数类型属性。 |
CategoryId | Integer | 20 |
图片类目。 |
ProductId | String | 2092061_1 |
商品ID。 |
StrAttr | String | ss |
字符串类型属性。 |
SortExprValues | String | 5.37633353624177e+24;0 |
系统打分信息。 说明
|
CustomContent | String | zidingyi |
用户自定义的内容。 |
Score | Float | 1 |
图片相似打分 范围: 0~1 。 |
Code | Integer | 0 |
错误码。 0:成功。 非0:失败。 |
PicInfo | object |
类目预测、主体识别结果等信息。 |
|
Region | String | 280,486,232,351 |
主体识别结果。 图片的主体区域,格式为x1,x2,y1,y2,其中 x1,y1 是左上角的点,x2,y2是右下角的点。若用户请求中指定了主体区域,则以请求中为准。 |
CategoryId | Integer | 20 |
类目预测结果。 若用户请求中指定了类目,则以请求中为准。 |
MultiRegion | Array of reg |
主体识别集合。 |
|
Region | String | 280,486,232,351 |
主体识别结果。 图片的主体区域,格式为x1,x2,y1,y2,其中 x1,y1 是左上角的点,x2,y2是右下角的点。若用户请求中指定了主体区域,则以请求中为准。 |
AllCategories | Array of Category |
系统支持的所有类目信息。 |
|
Name | String | 88888888 |
类目名称。 |
Id | Integer | other |
类目ID。 |
Success | Boolean | true |
请求是否成功。 |
示例
请求示例
{
"InstanceName": "demoinstance",
"ProductId": "ProductId",
"PicName”:“PicName"
}
正常返回示例
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"Auctions" : [ {
"CategoryId" : 0,
"PicName" : "demo",
"SortExprValues" : "7.33136443711219e+24;0",
"Score" : 1.0,
"ProductId" : "demo"
} ],
"Head" : {
"DocsReturn" : 1,
"DocsFound" : 1,
"SearchTime" : 155
},
"PicInfo" : {
"CategoryId" : 0,
"Region" : "111,697,113,774",
"AllCategories" : [ {
"Name" : "Tops",
"Id" : 0
}, {
"Name" : "Dress",
"Id" : 1
}, {
"Name" : "Bottoms",
"Id" : 2
}, {
"Name" : "Bag",
"Id" : 3
}, {
"Name" : "Shoes",
"Id" : 4
}, {
"Name" : "Accessories",
"Id" : 5
}, {
"Name" : "Snack",
"Id" : 6
}, {
"Name" : "Makeup",
"Id" : 7
}, {
"Name" : "Bottle",
"Id" : 8
}, {
"Name" : "Furniture",
"Id" : 9
}, {
"Name" : "Toy",
"Id" : 20
}, {
"Name" : "Underwear",
"Id" : 21
}, {
"Name" : "Digital device",
"Id" : 22
}, {
"Name" : "Other",
"Id" : 88888888
} ],
"MultiRegion" : [ ]
},
"RequestId" : "D61D869E-E92A-447F-AD67-9234F999E516",
"Msg" : "success",
"Success" : true,
"Code" : 0
}
错误码
HttpCode | 错误码 | 错误信息 | 描述 |
---|---|---|---|
400 | BadRequest | The request has invalid parameters. | 无效的参数 |
400 | InstanceStatusError | Your instance is unavailable. | 实例状态不可用 |
400 | InvalidInstance | The specified instance name is invalid. | 实例名错误 |
400 | NoCaretSeperator | The body content is missing the ^ separator. | 请求body缺少特定符号 |
400 | EmptyMeta | The body content has an empty meta field. | 请求body含有空的字段 |
400 | InvalidMetaItem | The meta field is invalid. | 无效的元信息字段 |
400 | NoPicList | The body content is missing the pic_list parameter. | 未指定pic_list字段 |
400 | InvalidPicList | The specified pic_list parameter is invalid. | 无效的pic_list字段 |
400 | InvalidCategory | The specified category is invalid. | 无效的类目id |
400 | OverflowMaxResultNum | The specified number of total results exceeds the maximum of 500. | 超过了最大的返回结果限制数500 |
400 | OverflowMaxReturnNum | The specified number of results for each request exceeds the maximum of 100. | 单次返回数超过限制值100 |
400 | InvalidNumParameter | The specified parameter num is invalid. | 无效的字段num |
400 | InvalidIntAttr | The specified int_attr field is invalid. | 无效的int过滤字段 |
400 | UnsupportedPicFormat | The specified image format is invalid. | 无效的图片格式 |
400 | InvalidFilterClause | The specified filtering condition is invalid. | 无效的过滤条件 |
400 | InstanceOverQuota | The number of items exceeds the limit. | 实例的图片数量超过限制值 |
400 | IncorrectOrientation | The image contains incorrect rotation flags in the meta data. | 图片包含不支持的旋转参数 |
400 | UnsupportedPicPixels | The specified pixels is not supported. | 图片像素值不支持 |
403 | NoPermission | You are not authorized to perform this operation. | 未授权的行为 |
403 | DeniedRequest | Your request was denied due to instance flow control. | 请求被限流 |
500 | InternalError | An internal server error occurred. | 内部错误 |
500 | NetworkException | A network error occurred. | 内部错误:请求网络异常 |
500 | UnsupportedInstanceType | The instance type is not supported. | 内部错误:不支持的实例类型 |
500 | UnsupportedOperationType | The specified action is not supported. | 内部错误:不支持的action |
500 | AccessEngineFailed | An error occurred while accessing the search engine. | 内部错误:请求引擎失败 |
500 | InternalOssError | An internal OAS error occurred. | 内部错误:请求内部算法错误 |
500 | InternalSwiftError | An internal SWIFT error occurred. | 内部错误:请求内部消息队列错误 |
500 | InternalTableStoreError | An internal Table Store error occurred. | 内部错误:请求特征存储错误 |
访问错误中心查看更多错误码。
错误码
请参见错误码。