京东商品数据接口是指可以通过关键词搜索京东商品的接口。以下是一个示例接口:
接口名称:京东商品搜索接口
接口地址:c0b.cc/30G0f2
请求方式:GET
请求参数:
请求参数:q=女装&start_price=0&end_price=0&page=1&cat=0&discount_only=&sort=&seller_info=no&nick=&seller_info=&nick=&ppath=&imgid=&filter=
参数说明:q:搜索关键字
sort:排序[bid,_bid,_sale,_review,_new]
(bid:总价,sale:销量,review评论数,new新品,加_前缀为从大到小排序)<
page:
接口调用示例:
import Foundation
let url = URL(string: "api-gw.xxx.cn/jd/item_search/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&q=女装&start_price=0&end_price=0&page=1&cat=0&discount_only=&sort=&seller_info=no&nick=&seller_info=&nick=&ppath=&imgid=&filter=")!
let task = URLSession.shared.dataTask(with: url) { data, response, error in
guard let data = data else {
print("Error: No data was returned")
return
}
if let data = String(data: data, encoding: .utf8) {
print(data)
}
}
task.resume()
注意:上述示例中的your_appkey
需要替换成自己的开发者应用密钥,可以在京东开放平台申请获得。
返回参数: