• 唯品会常用的两个API接口:关键字搜索API、获取商品详情数据API


    随着电子商务的飞速发展,API接口已经成为各个电商平台与外部开发者进行数据交互的主要手段。本文将重点介绍唯品会常用的两个API接口:关键字搜索API和获取商品详情数据API,以及它们如何帮助电商开发者进行高效的数据交互。

    一、关键字搜索API

    关键字搜索API是唯品会提供的用于商品搜索的核心API。它允许开发者根据用户输入的关键字进行商品搜索,从而获取相关商品信息。该API的使用流程如下:

    1、调用接口

    首先,开发者需要向唯品会申请API密钥,并使用该密钥进行身份验证。然后,通过调用唯品会提供的API接口,将用户输入的关键字作为参数传递给服务器。扫码即可获取api测试key

    名称类型必须描述
    keyString调用key(必须以GET方式拼接在URL中)
    secretString调用密钥
    api_nameStringAPI接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等]
    cacheString[yes,no]默认yes,将调用缓存的数据,速度比较快
    result_typeString[json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读
    langString[cn,en,ru]翻译语言,默认cn简体中文
    versionStringAPI版本

    2、服务器处理

    唯品会的服务器接收到关键字后,会根据预设的算法对关键字进行匹配和排序。这个过程中,服务器会综合考虑商品名称、描述、价格等多种因素,以确定搜索结果的相关性和排序顺序。

    3、返回结果

    服务器将处理后的结果返回给开发者。通常情况下,返回结果包括商品ID、名称、描述、价格等信息。开发者可以根据这些信息展示给用户相应的搜索结果。

    Version: Date:

    名称类型必须示例值描述

    num_iid

    Bigint0969908-145512642宝贝ID

    title

    String0男童白底满印熊猫大侠短袖包屁衣宝贝标题

    desc_short

    String0商品简介

    price

    Float049.00价格

    total_price

    Float00

    suggestive_price

    Float00

    orginal_price

    Float0109.00原价

    nick

    String0掌柜昵称

    num

    Int0

    min_num

    Int00

    detail_url

    String0http://www.vip.com/detail-969908-145512642.html宝贝链接

    pic_url

    String0宝贝图片

    brand

    String0功夫熊猫品牌名称

    brandId

    Int0品牌ID

    rootCatId

    Int0顶级分类ID

    cid

    Int0

    crumbs

    Mix0[]

    created_time

    String0

    modified_time

    String0

    delist_time

    String0

    desc

    String0

    desc_img

    Mix0["//a.vpimg3.com/upload/merchandise/other/440246/KFP-8523077W00-6.jpg"]描述图片

    item_imgs

    Mix0[]商品图片

    item_weight

    String0

    item_size

    String0

    location

    String0发货地

    post_fee

    Float0物流费用

    express_fee

    Float0快递费用

    ems_fee

    Float0EMS费用

    shipping_to

    String0发货至

    has_discount

    Boolean0

    video

    Mix0[]商品视频

    is_virtual

    String0

    sample_id

    String0商品风格标识ID

    is_promotion

    Boolean0

    props_name

    String0商品属性名

    prop_imgs

    Mix0{"prop_img": []}商品属性图片列表

    property_alias

    String0商品属性别名

    props

    Mix0[{ "name": "夏","value": "常规" }]商品详情

    total_sold

    Int0

    skus

    Mix0{"sku": []商品规格信息

    seller_id

    Int0卖家ID

    sales

    Int0销量

    shop_id

    Int0店铺ID

    props_list

    Mix0[]商品属性

    seller_info

    Mix0{"nick": "", "city": "", "level": "", "rate": "", "shop_type": "", "user_num_id": "", "shopid": "", "shopname": "", "shop_href": "", "tel": "", "menu": [] }卖家信息

    tmall

    Boolean0是否天猫

    error

    String0错误信息

    warning

    String0警告信息

    url_log

    String0

    stuff_status

    String0

    data_from

    String0app_vip

    method

    String0

    promo_type

    String0

    props_img

    Mix0[]属性图片

    rate_grade

    String0

    priceRange

    Mix0[]

    shop_item

    Mix0[]

    relate_items

    Mix0[]

    shop_url

    String0https://list.vip.com/brand.html?sn=10020198

    关键字搜索API具有以下特点:

    • 高效性:唯品会的算法针对搜索进行了优化,能够快速返回相关度高的搜索结果。
    • 灵活性:开发者可以根据需求自定义搜索条件,例如地理位置、价格范围等。
    • 实时性:搜索结果实时更新,能够反映最新的商品信息。

    二、获取商品详情数据API

    获取商品详情数据API是唯品会提供的用于获取商品详细信息的API。它允许开发者根据商品ID获取商品的详细信息,包括商品的名称、描述、价格、图片等。该API的使用流程如下:

    1、调用接口

    开发者使用已申请的API密钥进行身份验证,并通过调用唯品会提供的API接口来获取商品详情数据。需要传递商品ID作为参数给服务器。

    2、服务器处理

    唯品会的服务器接收到商品ID后,会查询数据库中的对应记录,并生成商品详情数据。然后,服务器将这些详细信息返回给开发者。

    3、返回结果

    服务器将处理后的结果返回给开发者。返回结果包括商品的名称、描述、价格、图片等信息。开发者可以根据这些信息展示给用户相应的商品详情页面。

    1. "item": {
    2. "num_iid": "1710613157-6918711233889249157",
    3. "title": "【清凉运动】森马夏季新款复古运动风男式休闲中裤短裤男",
    4. "desc_short": "",
    5. "price": "35.00",
    6. "total_price": 0,
    7. "suggestive_price": 0,
    8. "orginal_price": "159.00",
    9. "nick": "",
    10. "num": 0,
    11. "min_num": 0,
    12. "detail_url": "https://detail.vip.com/detail-1710613157-6918711233889249157.html",
    13. "pic_url": "https://a.vpimg3.com/upload/merchandise/pdcvis/104218/2020/0814/160/7932992b-c2f6-4ed2-a97b-69824fa7ba10.jpg",
    14. "brand": "森马",
    15. "brandId": 1710613157,
    16. "rootCatId": "",
    17. "cid": 390576,
    18. "crumbs": [],
    19. "created_time": 1537845115000,
    20. "modified_time": 1683886534000,
    21. "delist_time": 2145888000000,
    22. "desc": "",
    23. "desc_img": [
    24. "https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/1540464613-651972905622466560-651972905622466562-601.jpg",
    25. "https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/2056028139-651972905622466560-651972905622466562-602.jpg",
    26. "https://a.vpimg2.com/upload/merchandise/pdcvop/00104218/10004116/2103507544-651972905622466560-651972905622466562-603.jpg",
    27. "https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/805209464-651972905622466560-651972905622466562-604.jpg",
    28. "https://a.vpimg2.com/upload/merchandise/pdcvop/00104218/10004116/965265007-651972905622466560-651972905622466562-605.jpg",
    29. "https://a.vpimg2.com/upload/merchandise/pdcvop/00104218/10004116/1456204603-651972905622466560-651972905622466562-606.jpg",
    30. "https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/245784564-651972905622466560-651972905622466562-607.jpg",
    31. "https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/478942397-651972905622466560-651972905622466562-608.jpg",
    32. "https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/563202406-651972905622466560-651972905622466562-609.jpg",
    33. "https://a.vpimg2.com/upload/merchandise/pdcvop/00104218/10004116/576808585-651972905622466560-651972905622466562-610.jpg",
    34. "https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/492548576-651972905622466560-651972905622466562-611.jpg",
    35. "https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/475079584-651972905622466560-651972905622466562-612.jpg",
    36. "https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/643984351-651972905622466560-651972905622466562-613.jpg",
    37. "https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/723627373-651972905622466560-651972905622466562-614.jpg",
    38. "https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/353669547-651972905622466560-651972905622466562-615.jpg",
    39. "https://a.vpimg2.com/upload/merchandise/pdcvop/00104218/10004116/241322868-651972905622466560-651972905622466562-616.jpg",
    40. "https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/270393169-651972905622466560-651972905622466562-617.jpg"
    41. ],
    42. "item_imgs": [
    43. {
    44. "url": "https://a.vpimg4.com/upload/merchandise/pdcvis/104218/2020/0814/160/7932992b-c2f6-4ed2-a97b-69824fa7ba10_750x750_75.jpg"
    45. },
    46. {
    47. "url": "https://a.vpimg2.com/upload/merchandise/pdcvis/104218/2020/0610/171/dbe0c41b-4a98-49f3-a5ec-8a4da2866892_750x750_75.jpg"
    48. },
    49. {
    50. "url": "https://a.vpimg4.com/upload/merchandise/pdcvis/104218/2020/0519/147/b64c59ed-838d-48df-bd78-89f55e375a5a_750x750_75.jpg"
    51. },
    52. {
    53. "url": "https://a.vpimg3.com/upload/merchandise/pdcvis/104218/2020/0519/137/29223c17-dc85-412f-80c8-e0332f2f68d5_750x750_75.jpg"
    54. },
    55. {
    56. "url": "https://a.vpimg4.com/upload/merchandise/pdcvis/104218/2020/0519/185/8cd6c2f7-bc39-49a5-bf98-cebb1e764dd4_750x750_75.jpg"
    57. },
    58. {
    59. "url": "https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/25466546-651972905622466560-651972905622466562-2_750x750_75.jpg"
    60. },
    61. {
    62. "url": "https://a.vpimg2.com/upload/merchandise/pdcvop/00104218/10004116/1077608551-651972905622466560-651972905622466562-3_750x750_75.jpg"
    63. },
    64. {
    65. "url": "https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/1680510077-651972905622466560-651972905622466562-4_750x750_75.jpg"
    66. },
    67. {
    68. "url": "https://a.vpimg4.com/upload/merchandise/pdcvop/00104218/10004116/1463673259-651972905622466560-651972905622466562-15_750x750_75.jpg"
    69. },
    70. {
    71. "url": "https://a.vpimg3.com/upload/merchandise/pdcvop/00104218/10004116/1627814802-651972905622466560-651972905622466562-16_750x750_75.jpg"
    72. },
    73. {
    74. "url": "https://a.vpimg4.com/upload/merchandise/pdcvis/104218/2020/0610/102/36a2bb01-d66a-4ea9-a7b0-07b4231be7ec_750x750_75.jpg"
    75. }
    76. ],
    77. "item_weight": "",
    78. "item_size": "",
    79. "location": "",
    80. "post_fee": "",
    81. "express_fee": "",
    82. "ems_fee": "",
    83. "shipping_to": "",
    84. "has_discount": "",
    85. "video": "",
    86. "is_virtual": "",
    87. "sample_id": "",
    88. "is_promotion": "false",
    89. "props_name": "XL:黑色9000;M:黑色9000;XS:黑色9000;L:黑色9000;S:黑色9000;XXL:黑色9000;XXXL:黑色9000;",
    90. "prop_imgs": {
    91. "prop_img": []
    92. },
    93. "property_alias": "",
    94. "props": null,
    95. "total_sold": "0",
    96. "skus": {
    97. "sku": [
    98. {
    99. "price": "35",
    100. "sales": 1,
    101. "total_price": 0,
    102. "orginal_price": "159",
    103. "properti": {
    104. "134": "黑色9000",
    105. "453": "XL"
    106. },
    107. "quantity": null,
    108. "sku_id": "6918711233889253253"
    109. },
    110. {
    111. "price": "35",
    112. "sales": 1,
    113. "total_price": 0,
    114. "orginal_price": "159",
    115. "properti": {
    116. "134": "黑色9000",
    117. "453": "M"
    118. },
    119. "quantity": null,
    120. "sku_id": "6918711233889257349"
    121. },
    122. {
    123. "price": "35",
    124. "sales": 1,
    125. "total_price": 0,
    126. "orginal_price": "159",
    127. "properti": {
    128. "134": "黑色9000",
    129. "453": "XS"
    130. },
    131. "quantity": null,
    132. "sku_id": "6918711233922930565"
    133. },
    134. {
    135. "price": "35",
    136. "sales": 1,
    137. "total_price": 0,
    138. "orginal_price": "159",
    139. "properti": {
    140. "134": "黑色9000",
    141. "453": "L"
    142. },
    143. "quantity": null,
    144. "sku_id": "6918711233939748741"
    145. },
    146. {
    147. "price": "35",
    148. "sales": 1,
    149. "total_price": 0,
    150. "orginal_price": "159",
    151. "properti": {
    152. "134": "黑色9000",
    153. "453": "S"
    154. },
    155. "quantity": null,
    156. "sku_id": "6918711233956571013"
    157. },
    158. {
    159. "price": "35",
    160. "sales": 1,
    161. "total_price": 0,
    162. "orginal_price": "159",
    163. "properti": {
    164. "134": "黑色9000",
    165. "453": "XXL"
    166. },
    167. "quantity": null,
    168. "sku_id": "6918711234007082885"
    169. },
    170. {
    171. "price": "35",
    172. "sales": 1,
    173. "total_price": 0,
    174. "orginal_price": "159",
    175. "properti": {
    176. "134": "黑色9000",
    177. "453": "XXXL"
    178. },
    179. "quantity": null,
    180. "sku_id": "6918711234023888773"
    181. }
    182. ]
    183. },
    184. "seller_id": "",
    185. "sales": 1,
    186. "shop_id": "",
    187. "props_list": [],
    188. "seller_info": {
    189. "title": "",
    190. "shop_name": "唯品自营",
    191. "sid": "",
    192. "zhuy": "",
    193. "level": "",
    194. "shop_type": "",
    195. "user_num_id": "ST00000",
    196. "nick": "",
    197. "cid": null,
    198. "delivery_score": "",
    199. "item_score": "",
    200. "tell": "",
    201. "addre": "",
    202. "score_p": ""
    203. },
    204. "tmall": "false",
    205. "error": "",
    206. "warning": "",
    207. "url_log": [],
    208. "stuff_status": "",
    209. "data_from": "ztk",
    210. "method": "",
    211. "promo_type": null,
    212. "props_img": [],
    213. "rate_grade": "",
    214. "priceRange": [],
    215. "shop_item": [],
    216. "relate_items": [],
    217. "shop_url": "",
    218. "format_check": "ok"
    219. },
    220. "error": "",
    221. "secache": "ce598a0a94090cd039c992849588a446",
    222. "secache_time": 1695521259,
    223. "secache_date": "2023-09-24 10:07:39",
    224. "translate_status": "",
    225. "translate_time": 0,
    226. "language": {
    227. "default_lang": "cn",
    228. "current_lang": "cn"
    229. },
    230. "reason": "",
    231. "error_code": "0000",

    获取商品详情数据API具有以下特点:

    • 准确性:唯品会的服务器能够准确获取商品的详细信息,确保数据的准确性。
    • 实时性:商品详情数据实时更新,能够反映最新的商品信息。
    • 可定制性:开发者可以根据需求自定义返回的字段,例如展示哪些商品的属性信息等。

    综上所述,关键字搜索API和获取商品详情数据API是唯品会常用的两个核心API接口。它们分别用于处理用户的搜索请求和获取商品的详细信息,为电商开发者提供了高效的数据交互方式。通过这些API,开发者可以快速地获取到用户所需的商品信息,并将这些信息展示给用户,提高用户体验和转化率。同时,这些API也提供了灵活性和可定制性,使得开发者可以根据自身需求进行定制化的功能开发。

  • 相关阅读:
    操作系统 进程同步及线程满分作业
    聊一聊Elasticsearch的一些基本信息
    【算法笔记】树状数组/Binary Indexed Tree/Fenwick Tree
    读书笔记—《如何阅读一本书》
    停车系统源码
    SpringMVC-拦截器
    C语言——操作符详解
    【C语言学习笔记---内存函数】
    使用句法依存分析实现KBQA中的约束挂载
    Jetbrains idea整合远程的docker服务器
  • 原文地址:https://blog.csdn.net/YONG823_API/article/details/133233147