淘寶API系列:淘寶/天貓獲取商品歷史價格資訊

JenniferAB發表於2023-02-27

淘寶如何檢視商品歷史價格,如何獲取歷史最低價呢?

item_history_price- 獲取商品歷史價格資訊

公共引數

名稱 型別 必須 描述
key String 呼叫key(獲取key加qq1635608656)
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=584458528092

引數說明:num_iid:商品id

響應引數

Version: Date:

名稱 型別 必須 示例值 描述
num_iid
Bigint 0 584458528092 寶貝ID
title
String 0 女裝 SUPIMA COTTON圓領T恤(短袖) 413674 優衣庫UNIQLO 商品標題
detail_url
String 0 寶貝連結
pic_url
String 0
寶貝圖片
lower_price
Float 0 39.00 最低價
lower_date
String 0 2020-12-22 最低價日期
current_price
Float 0 39.00 當前價
change_price_remark
String 0

item
Mix 0 {"date": "2020-06-25", "price": "39.00", "discount": "",} 價格資訊

請求示例

<?php
// 請求示例 url 預設請求引數已經URL編碼處理
// 本示例程式碼未加密secret引數明文傳輸,若要加密請參考:
$method = "GET";
$url = "https://伺服器地址/taobao/item_history_price/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=584458528092";
$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));
?>

響應示例(部分)

---------------------------------------
Result Object:
---------------------------------------
{
	"items": {
		"num_iid": "584458528092",
		"detail_url": "",
		"item": [
			{
				"price": "39.00",
				"data": "2022,0,1",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,2",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,3",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,4",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,5",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,6",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,7",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,8",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,9",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,10",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,11",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,12",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,13",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,14",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,15",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,16",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,17",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,18",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,19",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,20",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,21",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,22",
				"discount": ""
			},
			{
				"price": "39.00",
				"data": "2022,0,23",
				"discount": ""
			},


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/70026969/viewspace-2937233/,如需轉載,請註明出處,否則將追究法律責任。

相關文章