根据ID取商品详情的拼多多 API 接口返回值说明

174 阅读3分钟

pinduoduo API 接入说明

  1. API地址:
    申请调用KEY地址

  2. 调用示例:

-- 请求示例 url 默认请求参数已经URL编码处理 curl -i "https://api-gw.…….cn/pinduoduo/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=1620002566"

<?php

// 请求示例 url 默认请求参数已经URL编码处理
// 本示例代码未加密secret参数明文传输,若要加密请参考:https://open.…….cn/help/demo/sdk/demo-sign.php
$method = "GET";
$url = "https://api-gw.…….cn/pinduoduo/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=1620002566";
$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));
?>
```
``
```
# coding:utf-8
"""
Compatible for python2.x and python3.x
requirement: pip install requests
"""
from __future__ import print_function
import requests
# 请求示例 url 默认请求参数已经做URL编码
url = "https://api-gw.…….cn/pinduoduo/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=1620002566"
headers = {
    "Accept-Encoding": "gzip",
    "Connection": "close"
}
if __name__ == "__main__":
    r = requests.get(url, headers=headers)
    json_obj = r.json()
    print(json_obj)
```

1.  参数说明

    -   通用参数说明

        -   version:API版本
        -   key:调用key,测试key:test_api_key
        -   api_name:API类型[item_search,item_get]
        -   cache:[yes,no]默认yes,将调用缓存的数据,速度比较快
        -   result_type:[json,xml,serialize,var_export]返回数据格式,默认为json
        -   lang:[cn,en,ru] 翻译语言,默认cn简体中文

    -   API:item_search 参数说明: q:搜索关键词 cat:分类ID start_price:开始价格 end_price:结束价格 sort:排序 page:

    -   API:item_get 参数说明: num_iid:商品id【num_iid=15202941.  此API目前支持以下基本接口:

    -   item_get 根据ID取商品详情
    -   item_search 根据关键词取商品列表
    -   item_search_data 获得搜索词统计
    -   item_search_suggest 获得搜索词推荐
    
    ### pinduoduo.item_get

[]()公共参数

请求地址: https://api-gw.…….cn/pinduoduo/item_get

| 名称          | 类型     | 必须 | 描述                                                                     |
| ----------- | ------ | -- | ---------------------------------------------------------------------- |
| 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版本                                                                  |

[]()请求参数

请求参数:num_iid=1620002566

参数说明:num_iid:商品ID ;

[]()响应参数

Version: Date:

| 名称             | 类型     | 必须 | 示例值                                                                                                                                                                                                                          | 描述       |
| -------------- | ------ | -- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| num_iid        | String | 0  | 1999629976                                                                                                                                                                                                                   | 商品ID     |
| title          | String | 0  | 2019新款女装短袖t恤女夏宽松韩版休闲上衣百搭蝙蝠衫五分袖体恤                                                                                                                                                                                             | 商品标题     |
| price          | Float  | 0  | 8.8                                                                                                                                                                                                                          | 价格       |
| minGroupPrice  | String | 0  |                                                                                                                                                                                                                              |          |
| maxGroupPrice  | String | 0  |                                                                                                                                                                                                                              |          |
| total_price    | Float  | 0  |                                                                                                                                                                                                                              |          |
| orginal_price  | Float  | 0  |                                                                                                                                                                                                                              | 原价       |
| nick           | String | 0  | 雅怡服饰1688                                                                                                                                                                                                                     | 卖家昵称     |
| num            | Int    | 0  | 233                                                                                                                                                                                                                          | 库存       |
| sales          | Int    | 0  | 76                                                                                                                                                                                                                           | 销量       |
| detail_url     | String | 0  | http://yangkeduo.com/goods.html?goods_id=1999629976                                                                                                                                                                          | 宝贝链接     |
| desc           | String | 0  | 本店默认申通快递【还有百世汇通 中通快递 中通 韵达 邮政】。商家建议尺码仅供参考。如有其它问题请及时联系客服!喜欢的赶紧购买,质量保证,买的放心,穿的也开心!                                                                                                                                             | 商品备注     |
| item_imgs      | Mix    | 0  | [{"url": "//t00img.yangkeduo.com/t05img/images/2018-06-28/24bcb29df1195edaea840afd3e1bdaf9.jpeg?imageMogr2/strip%7CimageView2/2/w/1300/q/80"}]                                                                               | 宝贝图片列表   |
| pic_url        | String | 0  | //t00img.yangkeduo.com/t05img/images/2018-06-28/24bcb29df1195edaea840afd3e1bdaf9.jpeg?imageMogr2/thumbnail/150x/quality/50                                                                                                   | 宝贝图片     |
| props_name     | String | 0  |                                                                                                                                                                                                                              | 商品属性名    |
| prop_imgs      | Mix    | 0  | {"prop_img": [ {"properties": "0:0;1:1", "url": "//t00img.yangkeduo.com/t10img/images/2018-06-28/5c8f783ab2c4fea0ffea8fac73d8b2c2.jpeg"}]}                                                                                   | 商品属性图片列表 |
| props          | Mix    | 0  |                                                                                                                                                                                                                              | 商品详情     |
| skus           | Mix    | 0  | {"sku": [{"price": "16.56", "total_price": null, "orginal_price": "20.9", "properties": "0:0;1:1", "properties_name": "0:0:颜色:黑色;1:1:尺码:M【75-100斤】", "quantity": 221, "sku_id": 36410965966}]                                | 商品规格信息   |
| props_list     | Mix    | 0  | { "0:0": "颜色:黑色","1:1": "尺码:M【75-100斤】"}                                                                                                                                                                                     | 商品属性     |
| props_img      | Mix    | 0  | {"0:0;1:1": "//t00img.yangkeduo.com/t10img/images/2018-06-28/5c8f783ab2c4fea0ffea8fac73d8b2c2.jpeg"}                                                                                                                         | 属性图片     |
| property_alias | String | 0  |                                                                                                                                                                                                                              | 商品属性别名   |
| seller_info    | Mix    | 0  | {"nick": "雅怡服饰1688", "city": "", "level": null, "rate": null, "score": 4.27, "delivery_score": 4.37, "item_score": 4.38, "shop_type": "", "user_num_id": "", "sid": 99033, "shop_name": "雅怡服饰1688", "zhuy": "", "menu": [] } | 卖家信息     |
| shop_item      | Mix    | 0  | []                                                                                                                                                                                                                           |          |
| relate_items   | Mix    | 0  | []