• 京东商品类目查询接口


    根据商品的父类目id查询子类目id信息,通常用获取各级类目对应关系,以便将推广商品归类。业务参数parentId、grade都输入0可查询所有一级类目ID,之后再用其作为parentId查询其子类目。

    【请求参数、 调用方式 GET/POST,支持高并发】

    请求参数:cid=0

    参数说明:cid:商品分类ID,可以用cid=0来获得所有一级类目

    【公共参数】

    名称类型必须描述
    keyString调用key(必须以GET方式拼接在URL中,点击获取调用key和secret
    secretString调用密钥 ( 接口代码教程wechat 19970108018 )
    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版本

    【 响应参数】

    名称类型是否隐私示例值描述
    idInt54商品分类ID
    nameString服饰配件、饰品分类名
    pidString0父分类ID
    root_idString0根分类ID
    itemMix{"id": 127464010,"name": "帽子/头巾","pid": "54","root_id": 0,sub[]}子分类id:子分类名称

    【请求代码示例(CURL、PHP 、PHPsdk 、Java 、C# 、Python…)  】

    1. # coding:utf-8
    2. """
    3. Compatible for python2.x and python3.x
    4. requirement: pip install requests
    5. """
    6. from __future__ import print_function
    7. import requests
    8. # 请求示例 url 默认请求参数已经做URL编码
    9. url = "https://wx19970108018/jd/cat_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&cid=0"
    10. headers = {
    11. "Accept-Encoding": "gzip",
    12. "Connection": "close"
    13. }
    14. if __name__ == "__main__":
    15. r = requests.get(url, headers=headers)
    16. json_obj = r.json()
    17. print(json_obj)

     【响应示例】

    1. {
    2. code: 200,
    3. msg: "请求成功【success】",
    4. data: [
    5. {
    6. grade: 0,
    7. name: "数码",
    8. id: 652,
    9. parentId: 0
    10. },
    11. {
    12. grade: 0,
    13. name: "电脑、办公",
    14. id: 670,
    15. parentId: 0
    16. },
    17. {
    18. grade: 0,
    19. name: "家用电器",
    20. id: 737,
    21. parentId: 0
    22. },
    23. {
    24. grade: 0,
    25. name: "食品饮料",
    26. id: 1320,
    27. parentId: 0
    28. },
    29. {
    30. grade: 0,
    31. name: "服饰内衣",
    32. id: 1315,
    33. parentId: 0
    34. },
    35. {
    36. grade: 0,
    37. name: "美妆护肤",
    38. id: 1316,
    39. parentId: 0
    40. },
    41. {
    42. grade: 0,
    43. name: "运动户外",
    44. id: 1318,
    45. parentId: 0
    46. },
    47. {
    48. grade: 0,
    49. name: "母婴",
    50. id: 1319,
    51. parentId: 0
    52. },
    53. {
    54. grade: 0,
    55. name: "家居日用",
    56. id: 1620,
    57. parentId: 0
    58. },
    59. {
    60. grade: 0,
    61. name: "图书",
    62. id: 1713,
    63. parentId: 0
    64. },
    65. {
    66. grade: 0,
    67. name: "礼品",
    68. id: 1672,
    69. parentId: 0
    70. },
    71. {
    72. grade: 0,
    73. name: "文娱",
    74. id: 4053,
    75. parentId: 0
    76. },
    77. {
    78. grade: 0,
    79. name: "本地生活/旅游出行",
    80. id: 4938,
    81. parentId: 0
    82. },
    83. {
    84. grade: 0,
    85. name: "钟表",
    86. id: 5025,
    87. parentId: 0
    88. },
    89. {
    90. grade: 0,
    91. name: "数字内容",
    92. id: 5272,
    93. parentId: 0
    94. },
    95. {
    96. grade: 0,
    97. name: "厨具",
    98. id: 6196,
    99. parentId: 0
    100. },
    101. {
    102. grade: 0,
    103. name: "珠宝首饰",
    104. id: 6144,
    105. parentId: 0
    106. },
    107. {
    108. grade: 0,
    109. name: "玩具乐器",
    110. id: 6233,
    111. parentId: 0
    112. },
    113. {
    114. grade: 0,
    115. name: "宠物生活",
    116. id: 6994,
    117. parentId: 0
    118. },
    119. {
    120. grade: 0,
    121. name: "汽车用品",
    122. id: 6728,
    123. parentId: 0
    124. },
    125. {
    126. grade: 0,
    127. name: "医药保健",
    128. id: 9192,
    129. parentId: 0
    130. },
    131. {
    132. grade: 0,
    133. name: "家装建材",
    134. id: 9855,
    135. parentId: 0
    136. },
    137. {
    138. grade: 0,
    139. name: "家具",
    140. id: 9847,
    141. parentId: 0
    142. },
    143. {
    144. grade: 0,
    145. name: "手机通讯",
    146. id: 9987,
    147. parentId: 0
    148. },
    149. {
    150. grade: 0,
    151. name: "鞋靴",
    152. id: 11729,
    153. parentId: 0
    154. },
    155. {
    156. grade: 0,
    157. name: "生鲜",
    158. id: 12218,
    159. parentId: 0
    160. },
    161. {
    162. grade: 0,
    163. name: "酒类",
    164. id: 12259,
    165. parentId: 0
    166. },
    167. {
    168. grade: 0,
    169. name: "团购",
    170. id: 12367,
    171. parentId: 0
    172. },
    173. {
    174. grade: 0,
    175. name: "整车",
    176. id: 12379,
    177. parentId: 0
    178. },
    179. {
    180. grade: 0,
    181. name: "农资园艺",
    182. id: 12473,
    183. parentId: 0
    184. },
    185. {
    186. grade: 0,
    187. name: "处方药",
    188. id: 13314,
    189. parentId: 0
    190. },
    191. {
    192. grade: 0,
    193. name: "教育培训",
    194. id: 13678,
    195. parentId: 0
    196. },
    197. {
    198. grade: 0,
    199. name: "二手商品",
    200. id: 13765,
    201. parentId: 0
    202. },
    203. {
    204. grade: 0,
    205. name: "邮币",
    206. id: 13887,
    207. parentId: 0
    208. },
    209. {
    210. grade: 0,
    211. name: "IP",
    212. id: 13996,
    213. parentId: 0
    214. },
    215. {
    216. grade: 0,
    217. name: "工业品",
    218. id: 14065,
    219. parentId: 0
    220. },
    221. {
    222. grade: 0,
    223. name: "房地产",
    224. id: 15083,
    225. parentId: 0
    226. },
    227. {
    228. grade: 0,
    229. name: "艺术品",
    230. id: 15126,
    231. parentId: 0
    232. },
    233. {
    234. grade: 0,
    235. name: "家纺",
    236. id: 15248,
    237. parentId: 0
    238. },
    239. {
    240. grade: 0,
    241. name: "家庭清洁/纸品",
    242. id: 15901,
    243. parentId: 0
    244. },
    245. {
    246. grade: 0,
    247. name: "京东服务",
    248. id: 15980,
    249. parentId: 0
    250. },
    251. {
    252. grade: 0,
    253. name: "个人护理",
    254. id: 16750,
    255. parentId: 0
    256. },
    257. {
    258. grade: 0,
    259. name: "箱包皮具",
    260. id: 17329,
    261. parentId: 0
    262. },
    263. {
    264. grade: 0,
    265. name: "非遗",
    266. id: 18528,
    267. parentId: 0
    268. }
    269. ]
    270. }

  • 相关阅读:
    使用QTableView实现九九乘法表
    单调栈的相关应用
    【Spring】Spring MVC
    手动撸代码实现Vue管道符过滤器filter功能
    记一次U8登录异常问题
    【OJ比赛日历】快周末了,不来一场比赛吗? #10.21-10.27 #11场
    41. 缺失的第一个正数
    信创服务器、中间件、数据库监控方案设计与实现
    数据结构.多项式加法
    Eclipse创建Servlet项目-7
  • 原文地址:https://blog.csdn.net/weixin_44591885/article/details/127093645