接口使用场景等说明:获得拼多多商品标签列表(非商品类目cat,当前仅开放给多多客使用)
环境 | http 地址 | https 地址 |
---|---|---|
正式环境 | http://api.veapi.cn/pdd/pdd_goodsopt | 暂无 |
参数名称 | 参数类型 | 必填 | 示例值 | 描述 |
---|---|---|---|---|
vekey | String | 是 | V123M56 | 公共参数,接口秘钥,请在会员中心获取 |
parent_opt_id | Intege | 是 | 值=0时为顶点opt_id,通过树顶级节点获取opt树 |
GET/POST http://api.veapi.cn/pdd/pdd_goodsopt?vekey=xxxx&parent_opt_id=13
$api="http://api.veapi.cn/pdd/pdd_goodsopt?vekey=xxxx&parent_opt_id=13"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $api); //curl_setopt($ch, CURLOPT_POST, true); //POST方式时启用 //curl_setopt($ch, CURLOPT_POSTFIELDS, $postData ); //POST方式时传参 curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //如果使用https请启用 curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //如果使用https请启用 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true ); //返回数据流,不直接输出 curl_setopt($ch, CURLOPT_ENCODING, 'gzip'); //使用gzip压缩传输让访问更快 curl_setopt($ch, CURLOPT_TIMEOUT, 6); //允许执行的最长秒数。这里设定6S curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); $result = curl_exec($ch); $info = curl_getinfo($ch); curl_close($ch); echo $result; //返回值
import cn.hutool.http.HttpResponse; import cn.hutool.http.HttpRequest; public class testGetParam { public static void main(String[] args) { // API网址 String url = "http://api.veapi.cn/pdd/pdd_goodsopt?vekey=xxxx&parent_opt_id=13"; // JDK 8u111版本后,若目标页面为HTTPS协议,请启用proxy用户密码鉴权 //System.setProperty("jdk.http.auth.tunneling.disabledSchemes", ""); // 发送请求 String result = HttpRequest.get(url) .timeout(10000)//设置超时,毫秒 .execute().body(); System.out.println(result); } }
import requests # 要访问的API网页 target_url = "http://api.veapi.cn/pdd/pdd_goodsopt?vekey=xxxx&parent_opt_id=13" # 发送请求 response = requests.get(target_url) # 获取页面内容 if response.status_code == 200: print response.text
参数名称 | 参数类型 | 示例值 | 描述 |
---|---|---|---|
level | Integer | 层级,1-一级,2-二级,3-三级,4-四级 | |
opt_id | Long | 商品标签ID | |
opt_name | String | 商品标签名 | |
parent_opt_id | Long | id所属父ID,其中,parent_id=0时为顶级节点 |
{ "error": "0", "msg": "查询商品标签列表成功", "data": [ { "parent_opt_id": "13", "level": "2", "opt_name": "海鲜水产", "opt_id": "146" }, { "parent_opt_id": "13", "level": "2", "opt_name": "蛋及蛋制品", "opt_id": "149" }, { "parent_opt_id": "13", "level": "2", "opt_name": "品质肉禽", "opt_id": "978" }, { "parent_opt_id": "13", "level": "2", "opt_name": "热带水果", "opt_id": "1254" }, { "parent_opt_id": "13", "level": "2", "opt_name": "瓜果桃梨", "opt_id": "2446" }, { "parent_opt_id": "13", "level": "2", "opt_name": "熟食凉菜", "opt_id": "2456" }, { "parent_opt_id": "13", "level": "2", "opt_name": "冰淇淋/冻品", "opt_id": "3551" }, { "parent_opt_id": "13", "level": "2", "opt_name": "柑桔橙柚", "opt_id": "5121" }, { "parent_opt_id": "13", "level": "2", "opt_name": "水果及制品", "opt_id": "25145" }, { "parent_opt_id": "13", "level": "2", "opt_name": "蔬菜及制品", "opt_id": "25171" } ], "request_id": "afc2Nl4" }