在电商领域,抖音作为一个新兴的流量入口,其商品搜索功能尤其重要。抖音提供了按图搜索商品的API接口,允许用户通过上传图片来搜索商品,极大地提升了用户体验和购物效率。本文将详细介绍如何使用抖音按图搜索商品API,并解析其返回值。
抖音按图搜索商品API概述
抖音按图搜索商品API允许用户通过上传商品图片,系统会自动匹配并返回相似商品的详细信息。这项服务对于希望利用抖音平台进行商品推广和销售的商家来说非常有价值。
如何使用抖音按图搜索商品API
- 注册抖音开放平台账号:首先,你需要在抖音开放平台注册成为开发者,并创建应用以获取API调用凭证。
- 获取API调用凭证:在开发者平台中获取API密钥(API Key)或访问令牌(Access Token)。
- 调用按图搜索API:使用HTTP请求调用接口,传入图片URL和访问令牌作为参数。
- 处理响应数据:解析返回的JSON数据,提取商品详情信息。
API返回值说明
抖音按图搜索商品API返回的数据通常包括以下字段:
- 商品ID(num_iid):商品的唯一标识符。
- 标题(title):商品的标题,通常包含关键字。
- 价格(price):商品的价格信息。
- 销量(sales):商品的销售数量。
- 描述(description):商品的详细描述。
- 图片URL(image_url):商品图片的URL地址。
- SKU信息(skus):商品的不同规格和价格。
示例返回值
以下是一个示例的API返回值,展示了获取商品详情的结构:
item_search_img-
douyin.item_search_img
公共参数
名称 | 类型 | 必须 | 描述 |
---|---|---|---|
key | String | 是 | 调用key(必须以GET方式拼接在URL中) |
secret | String | 是 | 调用密钥 |
api_name | String | 是 | API接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等] |
cache | String | 否 | [yes,no]默认yes,将调用缓存的数据,速度比较快 |
result_type | String | 否 | [json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读 |
lang | String | 否 | [cn,en,ru]翻译语言,默认cn简体中文 |
version | String | 否 | API版本 请求参数 |
请求参数:imgid=http://g-search3.alicdn.com/img/bao/uploaded/i4/O1CN01IDpcD81zHbpHs1YgT_!!2200811456689.jpg&cat=
参数说明:imgid: 支持本地图片、URL图片地址
响应参数
Version: Date:
名称 | 类型 | 必须 | 示例值 | 描述 |
---|---|---|---|---|
items | items[] | 0 | 按图搜索商品 |
响应示例
{
"items": {
"item": [
{
"title": "卫生纸5斤24卷5层加厚干湿两用卷纸家用纸巾厕纸卷筒纸家庭装实惠",
"pic_url": "https://p3-item.ecombdimg.com/img/ecom-shop-material/AgvBPXkH_m_538c7c5f021e459f37fba139dbdf9c5d_sx_335493_www800-800~tplv-5mmsx3fupr-image.jpeg",
"price": 23.99,
"num_iid": "3631161001782720257",
"shop_name": "大龙疆选纸品",
"shop_id": 100128852,
"detail_url": "https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3631161001782720257"
},
{
"title": "悬挂式抽纸家用实惠装卫生纸亲肤柔软面巾纸原生木浆餐巾纸可代发",
"pic_url": "https://p3-item.ecombdimg.com/img/ecom-shop-material/qKHuWrBe_m_e0e401bcd2550de0274adc34712efe05_sx_551953_www1024-1024~tplv-5mmsx3fupr-image.jpeg",
"price": 19.9,
"num_iid": "3670328250808271281",
"shop_name": "阳光6666",
"shop_id": 17258773,
"detail_url": "https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3670328250808271281"
},
{
"title": "(新疆包邮)24卷卫生纸加厚款家用厕纸干湿两用家庭装亲肤无芯卷纸",
"pic_url": "https://p3-item.ecombdimg.com/img/ecom-shop-material/QEcpSEf_m_a576e98fc8a75de180e7a3a054e38360_sx_173665_www800-800~tplv-5mmsx3fupr-image.jpeg",
"price": 26.9,
"num_iid": "3678228600483610707",
"shop_name": "新疆一姐百货",
"shop_id": 208512,
"detail_url": "https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3678228600483610707"
},
{
"title": "欣蜜儿挂抽悬挂式大包纸巾原木抽纸宿舍卫生纸母婴家用加厚餐巾纸",
"pic_url": "https://p26-item.ecombdimg.com/img/ecom-shop-material/VglVXHkX_m_7e6ac8498c47348f6cd36f78b6d7f86f_sx_409553_www800-800~tplv-5mmsx3fupr-image.jpeg",
"price": 9.9,
"num_iid": "3611090293241330285",
"shop_name": "欣蜜儿纸品湿巾旗舰店",
"shop_id": 8812388,
"detail_url": "https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3611090293241330285"
},
{
"title": "【宠粉福利】爱马橙悬挂式抽纸家用卫生纸原生木浆纸巾亲肤柔韧母婴",
"pic_url": "https://p26-item.ecombdimg.com/img/ecom-shop-material/xdQwlnYD_m_44b9cb64bac181c9a11173e802f1ca0b_sx_235946_www800-800~tplv-5mmsx3fupr-image.jpeg",
"price": 2.7,
"num_iid": "3685855208195358733",
"shop_name": "敏宝宝百货",
"shop_id": 173918159,
"detail_url": "https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3685855208195358733"
},
{
"title": "欣蜜儿加大加厚壁挂式抽纸原生木浆家用抽取式卫生纸提装整箱批发",
"pic_url": "https://p26-item.ecombdimg.com/img/ecom-shop-material/VglVXHkX_m_ce8a34021d96489790351478ae7c319c_sx_164337_www720-720~tplv-5mmsx3fupr-image.jpeg",
"price": 25.4,
"num_iid": "3628852005704999740",
"shop_name": "欣蜜儿纸品湿巾旗舰店",
"shop_id": 8812388,
"detail_url": "https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3628852005704999740"
},
{
"title": "明柔悬挂式绵柔亲肤面巾纸家用大包装餐巾纸抽取式纸巾卫生抽纸",
"pic_url": "https://p3-item.ecombdimg.com/img/ecom-shop-material/qXXRaYM_m_352172ab196ac016616c2b875f35118d_sx_214321_www790-1471~tplv-5mmsx3fupr-image.jpeg",
"price": 79.2,
"num_iid": "3637075582052865691",
"shop_name": "南安康美环宇纸品厂",
"shop_id": 4901975,
"detail_url": "https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3637075582052865691"
},
{
"title": "5斤24大卷无芯卷纸卫生间厕纸五层加厚干湿两用家用卫生纸实惠装",
"pic_url": "https://p3-item.ecombdimg.com/img/ecom-shop-material/zLxzdsIk_m_538c7c5f021e459f37fba139dbdf9c5d_sx_335493_www800-800~tplv-5mmsx3fupr-image.jpeg",
"price": 23.99,
"num_iid": "3626875528318978928",
"shop_name": "羽护纸品",
"shop_id": 88061824,
"detail_url": "https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3626875528318978928"
},
{
"title": "【欣蜜儿】大包壁挂式抽纸巾1280张家用悬挂式底部抽纸厕所卫生纸巾",
"pic_url": "https://p26-item.ecombdimg.com/img/ecom-shop-material/fmeXXyNI_m_02636ba97f5d721c572a8feab3716517_sx_134856_www800-800~tplv-5mmsx3fupr-image.jpeg",
"price": 5.9,
"num_iid": "3622604863894080073",
"shop_name": "九零壹零雲梦优选店",
"shop_id": 9173240,
"detail_url": "https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3622604863894080073"
},
{
"title": "【加量3000张】3大提悬挂式实惠装整箱批发壁挂纸抽纸面巾纸家用",
"pic_url": "https://p3-item.ecombdimg.com/img/ecom-shop-material/DJDUQXqO_m_adb9d1451f5057111c3ae611e0931998_sx_460353_www800-800~tplv-5mmsx3fupr-image.jpeg",
"price": 9.9,
"num_iid": "3652843337016300604",
"shop_name": "津洁生活官方旗舰店",
"shop_id": 86365609,
"detail_url": "https://haohuo.jinritemai.com/ecommerce/trade/detail/index.html?id=3652843337016300604"
}
],
"total_results": 200,
"real_total_results": 200,
"page_size": 10,
"pagecount": 20,
"has_more": true,
"page": "2",
"data_from": "leo"
},
"error_code": "0000",
"reason": "ok",
"secache": "786a853f4c64d321050d68e6fa74e1bf",
"secache_time": 1717745342,
"secache_date": "2024-06-07 15:29:02",
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},
"error": "",
"cache": 0,
"api_info": "today: max:15000 all[=++];expires:2031-01-01",
"execution_time": "1.965",
"server_time": "Beijing/2024-06-07 15:29:02",
"client_ip": "127.0.0.1",
"call_args": {
"imgid": "http://gw.alicdn.com/imgextra/i2/3937219703/O1CN01J6n5m42LY1r1rdGUv_!!3937219703-0-C2M.jpg_Q75.jpg"
},
"api_type": "douyin",
"server_memory": "3.31MB",
"last_id": false
}