随着电子商务的飞速发展,API接口已经成为各个电商平台与外部开发者进行数据交互的主要手段。本文将重点介绍唯品会常用的两个API接口:关键字搜索API和获取商品详情数据API,以及它们如何帮助电商开发者进行高效的数据交互。
关键字搜索API是唯品会提供的用于商品搜索的核心API。它允许开发者根据用户输入的关键字进行商品搜索,从而获取相关商品信息。该API的使用流程如下:
首先,开发者需要向唯品会申请API密钥,并使用该密钥进行身份验证。然后,通过调用唯品会提供的API接口,将用户输入的关键字作为参数传递给服务器。扫码即可获取api测试key
名称 | 类型 | 必须 | 描述 |
---|---|---|---|
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版本 |
唯品会的服务器接收到关键字后,会根据预设的算法对关键字进行匹配和排序。这个过程中,服务器会综合考虑商品名称、描述、价格等多种因素,以确定搜索结果的相关性和排序顺序。
服务器将处理后的结果返回给开发者。通常情况下,返回结果包括商品ID、名称、描述、价格等信息。开发者可以根据这些信息展示给用户相应的搜索结果。
Version: Date:
名称 | 类型 | 必须 | 示例值 | 描述 |
---|---|---|---|---|
num_iid |
Bigint | 0 | 969908-145512642 | 宝贝ID |
title |
String | 0 | 男童白底满印熊猫大侠短袖包屁衣 | 宝贝标题 |
desc_short |
String | 0 | 商品简介 | |
price |
Float | 0 | 49.00 | 价格 |
total_price |
Float | 0 | 0 | |
suggestive_price |
Float | 0 | 0 | |
orginal_price |
Float | 0 | 109.00 | 原价 |
nick |
String | 0 | 掌柜昵称 | |
num |
Int | 0 | ||
min_num |
Int | 0 | 0 | |
detail_url |
String | 0 | http://www.vip.com/detail-969908-145512642.html | 宝贝链接 |
pic_url |
String | 0 | 宝贝图片 | |
brand |
String | 0 | 功夫熊猫 | 品牌名称 |
brandId |
Int | 0 | 品牌ID | |
rootCatId |
Int | 0 | 顶级分类ID | |
cid |
Int | 0 | ||
crumbs |
Mix | 0 | [] | |
created_time |
String | 0 | ||
modified_time |
String | 0 | ||
delist_time |
String | 0 | ||
desc |
String | 0 | ||
desc_img |
Mix | 0 | ["//a.vpimg3.com/upload/merchandise/other/440246/KFP-8523077W00-6.jpg"] | 描述图片 |
item_imgs |
Mix | 0 | [] | 商品图片 |
item_weight |
String | 0 | ||
item_size |
String | 0 | ||
location |
String | 0 | 发货地 | |
post_fee |
Float | 0 | 物流费用 | |
express_fee |
Float | 0 | 快递费用 | |
ems_fee |
Float | 0 | EMS费用 | |
shipping_to |
String | 0 | 发货至 | |
has_discount |
Boolean | 0 | ||
video |
Mix | 0 | [] | 商品视频 |
is_virtual |
String | 0 | ||
sample_id |
String | 0 | 商品风格标识ID | |
is_promotion |
Boolean | 0 | ||
props_name |
String | 0 | 商品属性名 | |
prop_imgs |
Mix | 0 | {"prop_img": []} | 商品属性图片列表 |
property_alias |
String | 0 | 商品属性别名 | |
props |
Mix | 0 | [{ "name": "夏","value": "常规" }] | 商品详情 |
total_sold |
Int | 0 | ||
skus |
Mix | 0 | {"sku": [] | 商品规格信息 |
seller_id |
Int | 0 | 卖家ID | |
sales |
Int | 0 | 销量 | |
shop_id |
Int | 0 | 店铺ID | |
props_list |
Mix | 0 | [] | 商品属性 |
seller_info |
Mix | 0 | {"nick": "", "city": "", "level": "", "rate": "", "shop_type": "", "user_num_id": "", "shopid": "", "shopname": "", "shop_href": "", "tel": "", "menu": [] } | 卖家信息 |
tmall |
Boolean | 0 | 是否天猫 | |
error |
String | 0 | 错误信息 | |
warning |
String | 0 | 警告信息 | |
url_log |
String | 0 | ||
stuff_status |
String | 0 | ||
data_from |
String | 0 | app_vip | |
method |
String | 0 | ||
promo_type |
String | 0 | ||
props_img |
Mix | 0 | [] | 属性图片 |
rate_grade |
String | 0 | ||
priceRange |
Mix | 0 | [] | |
shop_item |
Mix | 0 | [] | |
relate_items |
Mix | 0 | [] | |
shop_url |
String | 0 | https://list.vip.com/brand.html?sn=10020198 |
关键字搜索API具有以下特点:
获取商品详情数据API是唯品会提供的用于获取商品详细信息的API。它允许开发者根据商品ID获取商品的详细信息,包括商品的名称、描述、价格、图片等。该API的使用流程如下:
开发者使用已申请的API密钥进行身份验证,并通过调用唯品会提供的API接口来获取商品详情数据。需要传递商品ID作为参数给服务器。
唯品会的服务器接收到商品ID后,会查询数据库中的对应记录,并生成商品详情数据。然后,服务器将这些详细信息返回给开发者。
服务器将处理后的结果返回给开发者。返回结果包括商品的名称、描述、价格、图片等信息。开发者可以根据这些信息展示给用户相应的商品详情页面。
"item": {
"num_iid": "1710613157-6918711233889249157",
"title": "【清凉运动】森马夏季新款复古运动风男式休闲中裤短裤男",
"desc_short": "",
"price": "35.00",
"total_price": 0,
"suggestive_price": 0,
"orginal_price": "159.00",
"nick": "",
"num": 0,
"min_num": 0,
"detail_url": "https://detail.vip.com/detail-1710613157-6918711233889249157.html",
"pic_url": "https://a.vpimg3.com/upload/merchandise/pdcvis/104218/2020/0814/160/7932992b-c2f6-4ed2-a97b-69824fa7ba10.jpg",
"brand": "森马",
"brandId": 1710613157,
"rootCatId": "",
"cid": 390576,
"crumbs": [],
"created_time": 1537845115000,
"modified_time": 1683886534000,
"delist_time": 2145888000000,
"desc": "",
"desc_img": [
"https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/1540464613-651972905622466560-651972905622466562-601.jpg",
"https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/2056028139-651972905622466560-651972905622466562-602.jpg",
"https://a.vpimg2.com/upload/merchandise/pdcvop/00104218/10004116/2103507544-651972905622466560-651972905622466562-603.jpg",
"https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/805209464-651972905622466560-651972905622466562-604.jpg",
"https://a.vpimg2.com/upload/merchandise/pdcvop/00104218/10004116/965265007-651972905622466560-651972905622466562-605.jpg",
"https://a.vpimg2.com/upload/merchandise/pdcvop/00104218/10004116/1456204603-651972905622466560-651972905622466562-606.jpg",
"https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/245784564-651972905622466560-651972905622466562-607.jpg",
"https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/478942397-651972905622466560-651972905622466562-608.jpg",
"https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/563202406-651972905622466560-651972905622466562-609.jpg",
"https://a.vpimg2.com/upload/merchandise/pdcvop/00104218/10004116/576808585-651972905622466560-651972905622466562-610.jpg",
"https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/492548576-651972905622466560-651972905622466562-611.jpg",
"https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/475079584-651972905622466560-651972905622466562-612.jpg",
"https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/643984351-651972905622466560-651972905622466562-613.jpg",
"https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/723627373-651972905622466560-651972905622466562-614.jpg",
"https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/353669547-651972905622466560-651972905622466562-615.jpg",
"https://a.vpimg2.com/upload/merchandise/pdcvop/00104218/10004116/241322868-651972905622466560-651972905622466562-616.jpg",
"https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/270393169-651972905622466560-651972905622466562-617.jpg"
],
"item_imgs": [
{
"url": "https://a.vpimg4.com/upload/merchandise/pdcvis/104218/2020/0814/160/7932992b-c2f6-4ed2-a97b-69824fa7ba10_750x750_75.jpg"
},
{
"url": "https://a.vpimg2.com/upload/merchandise/pdcvis/104218/2020/0610/171/dbe0c41b-4a98-49f3-a5ec-8a4da2866892_750x750_75.jpg"
},
{
"url": "https://a.vpimg4.com/upload/merchandise/pdcvis/104218/2020/0519/147/b64c59ed-838d-48df-bd78-89f55e375a5a_750x750_75.jpg"
},
{
"url": "https://a.vpimg3.com/upload/merchandise/pdcvis/104218/2020/0519/137/29223c17-dc85-412f-80c8-e0332f2f68d5_750x750_75.jpg"
},
{
"url": "https://a.vpimg4.com/upload/merchandise/pdcvis/104218/2020/0519/185/8cd6c2f7-bc39-49a5-bf98-cebb1e764dd4_750x750_75.jpg"
},
{
"url": "https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/25466546-651972905622466560-651972905622466562-2_750x750_75.jpg"
},
{
"url": "https://a.vpimg2.com/upload/merchandise/pdcvop/00104218/10004116/1077608551-651972905622466560-651972905622466562-3_750x750_75.jpg"
},
{
"url": "https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/1680510077-651972905622466560-651972905622466562-4_750x750_75.jpg"
},
{
"url": "https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/1463673259-651972905622466560-651972905622466562-15_750x750_75.jpg"
},
{
"url": "https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/1627814802-651972905622466560-651972905622466562-16_750x750_75.jpg"
},
{
"url": "https://a.vpimg4.com/upload/merchandise/pdcvis/104218/2020/0610/102/36a2bb01-d66a-4ea9-a7b0-07b4231be7ec_750x750_75.jpg"
}
],
"item_weight": "",
"item_size": "",
"location": "",
"post_fee": "",
"express_fee": "",
"ems_fee": "",
"shipping_to": "",
"has_discount": "",
"video": "",
"is_virtual": "",
"sample_id": "",
"is_promotion": "false",
"props_name": "XL:黑色9000;M:黑色9000;XS:黑色9000;L:黑色9000;S:黑色9000;XXL:黑色9000;XXXL:黑色9000;",
"prop_imgs": {
"prop_img": []
},
"property_alias": "",
"props": null,
"total_sold": "0",
"skus": {
"sku": [
{
"price": "35",
"sales": 1,
"total_price": 0,
"orginal_price": "159",
"properti": {
"134": "黑色9000",
"453": "XL"
},
"quantity": null,
"sku_id": "6918711233889253253"
},
{
"price": "35",
"sales": 1,
"total_price": 0,
"orginal_price": "159",
"properti": {
"134": "黑色9000",
"453": "M"
},
"quantity": null,
"sku_id": "6918711233889257349"
},
{
"price": "35",
"sales": 1,
"total_price": 0,
"orginal_price": "159",
"properti": {
"134": "黑色9000",
"453": "XS"
},
"quantity": null,
"sku_id": "6918711233922930565"
},
{
"price": "35",
"sales": 1,
"total_price": 0,
"orginal_price": "159",
"properti": {
"134": "黑色9000",
"453": "L"
},
"quantity": null,
"sku_id": "6918711233939748741"
},
{
"price": "35",
"sales": 1,
"total_price": 0,
"orginal_price": "159",
"properti": {
"134": "黑色9000",
"453": "S"
},
"quantity": null,
"sku_id": "6918711233956571013"
},
{
"price": "35",
"sales": 1,
"total_price": 0,
"orginal_price": "159",
"properti": {
"134": "黑色9000",
"453": "XXL"
},
"quantity": null,
"sku_id": "6918711234007082885"
},
{
"price": "35",
"sales": 1,
"total_price": 0,
"orginal_price": "159",
"properti": {
"134": "黑色9000",
"453": "XXXL"
},
"quantity": null,
"sku_id": "6918711234023888773"
}
]
},
"seller_id": "",
"sales": 1,
"shop_id": "",
"props_list": [],
"seller_info": {
"title": "",
"shop_name": "唯品自营",
"sid": "",
"zhuy": "",
"level": "",
"shop_type": "",
"user_num_id": "ST00000",
"nick": "",
"cid": null,
"delivery_score": "",
"item_score": "",
"tell": "",
"addre": "",
"score_p": ""
},
"tmall": "false",
"error": "",
"warning": "",
"url_log": [],
"stuff_status": "",
"data_from": "ztk",
"method": "",
"promo_type": null,
"props_img": [],
"rate_grade": "",
"priceRange": [],
"shop_item": [],
"relate_items": [],
"shop_url": "",
"format_check": "ok"
},
"error": "",
"secache": "ce598a0a94090cd039c992849588a446",
"secache_time": 1695521259,
"secache_date": "2023-09-24 10:07:39",
"translate_status": "",
"translate_time": 0,
"language": {
"default_lang": "cn",
"current_lang": "cn"
},
"reason": "",
"error_code": "0000",
获取商品详情数据API具有以下特点:
综上所述,关键字搜索API和获取商品详情数据API是唯品会常用的两个核心API接口。它们分别用于处理用户的搜索请求和获取商品的详细信息,为电商开发者提供了高效的数据交互方式。通过这些API,开发者可以快速地获取到用户所需的商品信息,并将这些信息展示给用户,提高用户体验和转化率。同时,这些API也提供了灵活性和可定制性,使得开发者可以根据自身需求进行定制化的功能开发。