item_list_weight-批量获取商品信息 [[查看演示] [API测试工具][注册开通]
taobao.item_list_weight
请求地址:申请调用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版本 |
请求参数:num_iids=14905766423,584458528092
参数说明:num_iids:商品id,多个用英文逗号分隔
Version: Date:
| 名称 | 类型 | 必须 | 示例值 | 描述 |
|---|---|---|---|---|
| num_iid | Bigint | 0 | 14905766423 | 宝贝ID |
| weight | Float | 0 | 0.24 | 重量 |
| unit | String | 0 | kg | 单位 |
<?php
//定义缓存目录和引入文件
define("DIR_RUNTIME","runtime/");
define("DIR_ERROR","runtime/");
define("SECACHE_SIZE","0");
//SDK下载地址 https://open.…….cn/help/demo/sdk……-api-sdk.zip
include ("ObApiClient.php");
$obapi = new otao\ObApiClient();
$obapi->api_url = "http://api-gw.……cn/";
$obapi->api_urls = array("http://api-gw…….cn/","http://api-1.……cn/");//备用API服务器
$obapi->api_urls_on = true;//当网络错误时,是否启用备用API服务器
$obapi->api_key = "<您自己的apiKey>";
$obapi->api_secret = "<您自己的apiSecret>";
$obapi->api_version ="";
$obapi->secache_path ="runtime/";
$obapi->secache_time ="86400";
$obapi->cache = true;
$api_data = $obapi->exec(
array(
"api_type" =>"taobao",
"api_name" =>"item_list_weight",
"api_params"=>array (
'num_iids' => '14905766423,584458528092',
)
)
);
var_dump($api_data);
?>
# 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-……taobao/item_list_weight/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iids……84458528092"
headers = {
"Accept-Encoding": "gzip",
"Connection": "close"
}
if __name__ == "__main__":
r = requests.get(url, headers=headers)
json_obj = r.json()
print(json_obj)