淘寶/天貓淘寶評論問答列表(item_question_answer-淘寶評論問答列表介面)

API測試Cris發表於2023-04-14

各位電商達人都明白好評的重要性,但同時好評回覆也是很重要的,產品得到客戶喜愛的同時,客戶花費時間寫好評,如果可以得到商家的用心回覆,會更增加客戶的好感度,從而將客戶轉化為店鋪忠實粉絲的機率也就會更大。


公共引數


名稱 型別 必須 描述

key String 呼叫key(必須以GET方式拼接在URL中)

secret String 呼叫金鑰(介面v;18870288846)

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=632521829807&page=1


引數說明:num_iid:商品ID

page:頁碼



響應引數


Version: Date:


名稱 型別 必須 示例值 描述

item


item[] 0 淘寶評論問答列表介面


請求示例


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 = "您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=632521829807&page=1";

JSONObject json = getRequestFromUrl(url);

System.out.println(json.toString());

}

 

}


響應示例


{

"num_iid": "520813250866",

"title": "三刃木摺疊過安檢創意迷你鑰匙扣鑰匙刀隨身多功能小刀包郵",

"pic_url": "!!2596264565.jpg",

"total_question": "19",

"page_size": 5,

"item_question": [

{

"id": "293305609635",

"question_title": "坐飛機,高鐵能過安檢不",

"detail_url": "

"total_answer": "2",

"creat_time": "2020-12-31",

"answer_info": {

"id": "293007420174",

"answer_title": "還沒試過,不知道。",

"answer_time": "2020-12-31",

"nick": "聽**雪",

"user_logo": "

}

},

{

"id": "258412350572",

"question_title": "小刀開啟後有鎖嗎",

"detail_url": "

"total_answer": "4",

"creat_time": "2020-04-02",

"answer_info": {

"id": "258440602228",

"answer_title": "沒有鎖,但質量不錯。",

"answer_time": "2020-04-03",

"nick": "風**7",

"user_logo": "*-vm*hv0kbPkl-MCxWMHkyPmIT"

}

},

{

"id": "90487630398",

"question_title": "鏈子容易斷嗎?",

"detail_url": "

"total_answer": "5",

"creat_time": "2017-07-01",

"answer_info": {

"id": "90491346914",

"answer_title": "可能會斷,你可以換別的掛啊!",

"answer_time": "2017-07-02",

"nick": "s**堂",

"user_logo": "*zMkk4MFkWO8Z-PFvWM8xYvGI4vG8Gv0cLPmNT"

}

},

{

"id": "98809187447",

"question_title": "能過航空安檢嗎",

"detail_url": "

"total_answer": "5",

"creat_time": "2018-04-17",

"answer_info": {

"id": "98818756863",

"answer_title": "航空就免了,畢竟是把刀,G20峰會時候我大拇指那麼短的刀刃連汽車站都過不去!",

"answer_time": "2018-04-17",

"nick": "幻***",

"user_logo": "*zMm*eO8c0vFQbv0cSXF-IOmMzvGQT"

}

},

{

"id": "90566746631",

"question_title": "請問這個刀片是可以一按就彈出來,還是要拔出來的丫",

"detail_url": "

"total_answer": "4",

"creat_time": "2017-07-13",

"answer_info": {

"id": "90567311785",

"answer_title": "是拔出來的  不能彈出來",

"answer_time": "2017-07-13",

"nick": "成**寶",

"user_logo": "*-Omk0X8xWvGkT"

}

}

],

"data_from": "app",

"error": "",

"reason": "",

"error_code": "0000",

"cache": 0,

"api_info": "today:34 max:10000",

"execution_time": 0.598,

"server_time": "Beijing/2021-04-22 15:57:27",

"client_ip": "106.6.32.155",

"call_args": [],

"api_type": "taobao",

"translate_language": "zh-CN",

"translate_engine": "google_cn",

"server_memory": "6.9MB",

"request_id": "gw-2.60812c66f2f0c"

}

文章內容有限,歡迎私信溝通交流。 


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

相關文章