随着电子商务的快速发展,越来越多的商家选择在京东这样的大型电商平台上开设店铺。为了帮助商家更高效地管理和展示商品,京东提供了一系列的API接口。本文将详细介绍京东店铺商品列表API接口,帮助开发者和商家更好地利用这一工具。
京东API概述
京东API是开放平台提供给开发者的一系列接口,通过这些接口,开发者可以访问京东的商品信息等数据。这些API接口支持多种编程语言,包括但不限于Java、Python、PHP等。
商品列表API接口功能
京东店铺商品列表API接口主要用于获取店铺内所有商品的列表信息,包括商品ID、名称、价格、库存、图片等。通过这个接口,商家可以快速获取店铺商品的实时数据,用于网站、APP或其他应用程序的商品展示。
获取key和秘钥进行测试
接口调用方式
请求URL
https://api-gw.onebound.cn/jd/item_search_shop
请求方法
GET
请求参数
参数名 | 类型 | 必填 | 描述 |
---|---|---|---|
shopId | String | 是 | 店铺ID |
page | Int | 否 | 页码,默认为1 |
pageSize | Int | 否 | 每页显示的商品数量,默认为20 |
sortType | String | 否 | 排序类型,如价格、销量等 |
响应格式
响应数据采用JSON格式,包含商品列表和分页信息。
示例代码
<?php// 请求示例 url 默认请求参数已经URL编码处理
// 本示例代码未加密secret参数明文传输,若要加密请参考:https://open.onebound.cn/help/demo/sdk/demo-sign.php
$method = "GET";
$url = "https://api-gw.onebound.cn/jd/item_search_shop/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&seller_nick=特步平途专卖店&page=1";
$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));
?>
安全性和限制
为了保证数据的安全性和API的稳定性,京东对API接口的使用有一定的限制,包括但不限于:
- 接口调用频率限制
- 需要进行身份验证
- 数据加密传输
返回数据说明
{"user": {"id": "","nick": "皓顿HAUTTON京东自营旗舰店","city": "","state": "","good_num": "","level": "","score": "","total_num": "","created": "","shop_type": "B","user_num_id": 1000081830,"cid": "","pic_url": "","delivery_score": "","item_score": "","sid": "","title": "","phone": "","zhuy": "//mall.jd.com/index-1000081830.html?from=pc","score_p": "","company_name": ""},"items": {"item": [{"num_iid": "100006965163","detail_url": "https://item.jd.com/100006965163.html","title": "皓顿休闲鞋男鞋头层牛皮时尚潮牌运动小白鞋百搭板鞋子男 9301XB148 白色 38码","pic_url": "//img13.360buyimg.com/n7/jfs/t1/153961/17/1801/305679/5f813073E03c570f7/8d5a59f610675771.jpg","price": 368,"promotion_price": 368,"sales": null,"sample_id": "","post_fee": "","seller": "皓顿HAUTTON京东自营旗舰店"},{"num_iid": "100008260461","detail_url": "https://item.jd.com/100008260461.html","title": "皓顿HAUT TON 休闲鞋男鞋头层牛皮高帮时尚潮牌运动小白鞋百搭板鞋靴子男 9393XB540 白色 39码","pic_url": "//img11.360buyimg.com/n7/jfs/t1/131902/17/11990/270074/5f813353E3ad47052/9d15482c3a553659.jpg","price": 398,"promotion_price": 398,"sales": null,"sample_id": "","post_fee": "","seller": "皓顿HAUTTON京东自营旗舰店"},{"num_iid": "100006965175","detail_url": "https://item.jd.com/100006965175.html","title": "皓顿休闲鞋男鞋头层牛皮时尚潮牌运动小白鞋百搭板鞋子男 9301XB148 白色 41码","pic_url": "//img10.360buyimg.com/n7/jfs/t1/129151/18/14410/305679/5f813097E2b67ae38/594356ed51abb69c.jpg","price": 368,"promotion_price": 368,"sales": null,"sample_id": "","post_fee": "","seller": "皓顿HAUTTON京东自营旗舰店"},{"num_iid": "100014803052","detail_url": "https://item.jd.com/100014803052.html","title": "皓顿HAUT TON 休闲鞋男鞋头层牛皮高帮时尚潮牌运动小白鞋百搭板鞋靴子男 9394GB411 白色 41码","pic_url": "//img12.360buyimg.com/n7/jfs/t1/128350/32/14720/262542/5f813012E457e96c4/bdf4fc8345082f34.jpg","price": 398,"promotion_price": 398,"sales": null,"sample_id": "","post_fee": "","seller": "皓顿HAUTTON京东自营旗舰店"},{"num_iid": "100012921200","detail_url": "https://item.jd.com/100012921200.html","title": "皓顿HAUT TON 休闲鞋男鞋头层牛皮韩版时尚潮牌运动小白鞋百搭板鞋子男 9303XB030 白色 39码","pic_url": "//img10.360buyimg.com/n7/jfs/t1/152705/30/1828/298006/5f812e75Ee03a3a12/3abde62340b8d3f6.jpg","price": 368,"promotion_price": 368,"sales": null,"sample_id": "","post_fee": "","seller": "皓顿HAUTTON京东自营旗舰店"}],"total_results": "5","page_size": "60","pagecount": 1,"page": "","url": "https://search.jd.com/Search?keyword=皓顿HAUTTON京东自营旗舰店&enc=utf-8&wq=皓顿HAUTTON京东自营旗舰店&pvid=33dbb420d9fa4ca483a869f2e4c5625c"},"error": "","secache": "e0f8552465a91326c012ad26414763d9","secache_time": 1615538585,"translate_status": "","translate_time": 0,"language": {"default_lang": "cn","current_lang": "cn"},"reason": "","error_code": "0000",