Development background:
With the continuous development of the e-commerce industry, people's shopping needs are increasing day by day. When purchasing goods, many people will obtain information or inspiration through means such as search engines and social media. However, it is not easy to find what you want in these channels, because there may be some advertisements or irrelevant content mixed in.
In order to make it easier for consumers to search for the products they want, many e-commerce platforms have begun to explore the function of searching for products by image. This function allows consumers to upload a picture, and then based on the characteristics of the items in the picture, similar products are automatically matched and recommended to consumers. Through image recognition technology and big data analysis, the accuracy and efficiency of product search can be greatly improved, enabling consumers to find the products they need more quickly.
Based on this background, major e-commerce platforms have gradually launched the function of searching for products by image, and provided corresponding API interfaces for developers to integrate into their own applications. Through the API interface, developers can easily access the function of searching for products by image on the e-commerce platform, realize data interaction with the corresponding platform, display recommended products, and support consumers to make one-click purchases and other operations.
Therefore, in order to better meet the needs of consumers and optimize the search experience, the API interface for searching products by image came into being.
API name: item_search_img
Function introduction: Get the product information list by passing in the request parameter imgid: image address (Taobao or Tmall image address is supported, the external address first calls the upload image (upload_img) interface and returns the image address), and the product information includes: baby title, list Type, baby picture, preferential price, price, sales volume, baby ID, product style ID, shopkeeper nickname, logistics cost, store location, baby link.
Public parameters:
name | type | must | describe |
---|---|---|---|
key | String | yes | Call key (must be spliced in the URL in GET mode) |
secret | String | yes | call key |
api_name | String | yes | API interface name (included in the request address) [item_search, item_get, item_search_shop, etc.] |
cache | String | no | [yes, no] The default is yes, the cached data will be called, and the speed is relatively fast |
result_type | String | no | [json,jsonu,xml,serialize,var_export] returns the data format, the default is json, and the content output by jsonu can be read directly in Chinese |
lang | String | no | [cn,en,ru] translation language, default cn Simplified Chinese |
version | String | no | API version |
Call example (PHP):
Support curl, PHP, Java, JavaScript, c#, Python, JS-SDK, Ruby, Swift, objective-C, C, C++, Node.JS, Kotlin, Rust, R, MATLAB and other languages
<?php
// 请求示例 url 默认请求参数已经URL编码处理
// 本示例代码未加密secret参数明文传输,若要加密请参考:https://o0b.cn/jennif
$method = "GET";
$url = "https://api-服务器.cn/taobao/item_search_img/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&imgid=http://g-search3.alicdn.com/img/bao/uploaded/i4/O1CN01IDpcD81zHbpHs1YgT_!!2200811456689.jpg&cat=";
$curl = curl_init();
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_SSL_VERIFYHOST,FALSE);
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER,FALSE);
curl_setopt($curl, CURLOPT_FAILONERROR, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
var_dump(curl_exec($curl));
?>
response parameters
Version: Date:
name | type | must | example value | describe |
---|---|---|---|---|
title |
String | 0 | Parent-child short-sleeved t-shirt social clothing family clothing a family of three mother and child mother and daughter pure cotton summer jacket trendy | baby title |
cid |
Int | 0 | 50015374 | |
list_type |
String | 0 | look-alike baby | list type |
pic_url |
String | 0 | //g-search3.alicdn.com/img/bao/uploaded/i4/TB26ry1rBsmBKNjSZFsXXaXSVXa_!!2628705716.jpg | baby pictures |
promotion_price |
String | 0 | 38.71 | discounted price |
price |
Float | 0 | 39.50 | price |
sales |
Int | 0 | 7 | Sales |
num_id |
Bigint | 0 | 575727312808 | Baby ID |
sample_id |
Bigint | 0 | 1627115368 | Commodity style identification ID |
seller_nick |
String | 0 | The exclusive taste of dzw | Shopkeeper Nickname |
is_tmall |
Bool | 0 | false | |
post_fee |
String | 0 | 0.00 | Logistics costs |
area |
String | 0 | Guangdong Dongguan | store location |
detail_url |
String | 0 | //item.taobao.com/item.htm?id=575727312808&ns=1#detail | baby link |