item_history_price - Get the historical price information of the item
taobao.item_history_price
public parameters
name | type | must | describe |
---|---|---|---|
key | String | yes | Call key ( get key ) |
secret | String | yes | call key |
api_name | String | yes | API interface name (included in the request address) [item_search, item_get, item_search_shop, etc.] |
cache | String | no | [yes, no] The default is yes, the cached data will be called, and the speed is relatively fast |
result_type | String | no | [json,jsonu,xml,serialize,var_export] returns the data format, the default is json, and the content output by jsonu can be read directly in Chinese |
lang | String | no | [cn,en,ru] translation language, default cn Simplified Chinese |
version | String | no | API version |
request parameters
Request parameter: num_iid=584458528092
Parameter description: num_iid: commodity id
response parameters
Version: Date:
name | type | must | example value | describe |
---|---|---|---|---|
num_id |
Bigint | 0 | 584458528092 | Baby ID |
title |
String | 0 | Women's SUPIMA COTTON round neck T-shirt (short sleeve) 413674 Uniqlo UNIQLO | product title |
detail_url |
String | 0 | https://item.taobao.com/item.htm?id=584458528092 | baby link |
pic_url |
String | 0 | baby pictures | |
lower_price |
Float | 0 | 39.00 | lowest price |
lower_date |
String | 0 | 2020-12-22 | lowest price date |
current_price |
Float | 0 | 39.00 | current price |
change_price_remark |
String | 0 | ||
item |
Mix | 0 | {"date": "2020-06-25", "price": "39.00", "discount": "",} | price information |
request example
curl: -- request example url The default request parameters have been URL encoded curl -i "https://api-server.cn/taobao/item_history_price/?key=<your own apiKey>&secret=<your own apiSecret>&num_iid =584458528092"
PHP:
<?php // Request example url The default request parameters have been URL encoded // This sample code does not encrypt the secret parameter for plaintext transmission, if you want to encrypt it, please refer to the documentation $method = "GET"; $url = "https://api -server.cn/taobao/item_history_price/?key=<your own apiKey>&secret=<your own 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_RET URNTRANSFER, true); curl_setopt($curl, CURLOPT_HEADER, true); curl_setopt($curl, CURLOPT_ENCODING,"gzip"); var_dump(curl_exec($curl)); ?>
JAVA:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URL;
import java.nio.charset.Charset;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.PrintWriter;
import java.net.URLConnection;
public class Example {
private static String readAll(Reader rd) throws IOException {
StringBuilder sb = new StringBuilder();
int cp;
while ((cp = rd.read()) != -1) {
sb.append((char) cp);
}
return sb.toString();
}
public static JSONObject postRequestFromUrl(String url, String body) throws IOException, JSONException {
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
conn.setDoOutput(true);
conn.setDoInput(true);
PrintWriter out = new PrintWriter(conn.getOutputStream());
out.print(body);
out.flush();
InputStream instream = conn.getInputStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONObject json = new JSONObject(jsonText);
return json;
} finally {
instream.close();
}
}
public static JSONObject getRequestFromUrl(String url) throws IOException, JSONException {
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
InputStream instream = conn.getInputStream();
try {
BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8")));
String jsonText = readAll(rd);
JSONObject json = new JSONObject(jsonText);
return json;
} finally {
instream.close();
}
}
public static void main(String[] args) throws IOException, JSONException {
// 请求示例 url 默认请求参数已经URL编码处理
String url = "https://api-服务器.cn/taobao/item_history_price/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=584458528092";
JSONObject json = getRequestFromUrl(url);
System.out.println(json.toString());
}
}