各位电商达人都明白好评的重要性,但同时好评回复也是很重要的,产品得到客户喜爱的同时,客户花费时间写好评,如果可以得到商家的用心回复,会更增加客户的好感度,从而将客户转化为店铺忠实粉丝的概率也就会更大。
公共参数
名称 类型 必须 描述
key String 是 调用key(必须以GET方式拼接在URL中)
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=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编码处理
JSONObject json = getRequestFromUrl(url);
System.out.println(json.toString());
}
}
响应示例
{
"num_iid": "520813250866",
"title": "三刃木折叠刀过安检创意迷你钥匙扣钥匙刀军刀随身多功能小刀包邮",
"pic_url": "https://gw.alicdn.com/tfscom/tuitui/i4/2596264565/O1CN01mbmuAB1jaogMUWhv8_!!2596264565.jpg",
"total_question": "19",
"page_size": 5,
"item_question": [
{
"id": "293305609635",
"question_title": "坐飞机,高铁能过安检不",
"detail_url": "https://market.m.taobao.com/app/mtb/questions-and-answers/pages/detail/index.html?from=answer&spm=a3134.14087530&id=293305609635",
"total_answer": "2",
"creat_time": "2020-12-31",
"answer_info": {
"id": "293007420174",
"answer_title": "还没试过,不知道。",
"answer_time": "2020-12-31",
"nick": "听**雪",
"user_logo": "https://wwc.alicdn.com/avatar/getAvatar.do?type=sns&width=64&height=64&userIdStr=M0xLPm84XFhhXHg4OFkSMmQYMCMIPCh-vkPhOH8SMFgT"
}
},
{
"id": "258412350572",
"question_title": "小刀打开后有锁吗",
"detail_url": "https://market.m.taobao.com/app/mtb/questions-and-answers/pages/detail/index.html?from=answer&spm=a3134.14087530&id=258412350572",
"total_answer": "4",
"creat_time": "2020-04-02",
"answer_info": {
"id": "258440602228",
"answer_title": "没有锁,但质量不错。",
"answer_time": "2020-04-03",
"nick": "风**7",
"user_logo": "https://wwc.alicdn.com/avatar/getAvatar.do?type=sns&width=64&height=64&userIdStr=M87-v07eM8lIvmRzO8*-vm*hv0kbPkl-MCxWMHkyPmIT"
}
},
{
"id": "90487630398",
"question_title": "链子容易断吗?",
"detail_url": "https://market.m.taobao.com/app/mtb/questions-and-answers/pages/detail/index.html?from=answer&spm=a3134.14087530&id=90487630398",
"total_answer": "5",
"creat_time": "2017-07-01",
"answer_info": {
"id": "90491346914",
"answer_title": "可能会断,你可以换别的挂啊!",
"answer_time": "2017-07-02",
"nick": "s**堂",
"user_logo": "https://wwc.alicdn.com/avatar/getAvatar.do?type=sns&width=64&height=64&userIdStr=X8ZIMH*zMkk4MFkWO8Z-PFvWM8xYvGI4vG8Gv0cLPmNT"
}
},
{
"id": "98809187447",
"question_title": "能过航空安检吗",
"detail_url": "https://market.m.taobao.com/app/mtb/questions-and-answers/pages/detail/index.html?from=answer&spm=a3134.14087530&id=98809187447",
"total_answer": "5",
"creat_time": "2018-04-17",
"answer_info": {
"id": "98818756863",
"answer_title": "航空就免了,毕竟是把刀,G20峰会时候我大拇指那么短的刀刃连汽车站都过不去!",
"answer_time": "2018-04-17",
"nick": "幻***",
"user_logo": "https://wwc.alicdn.com/avatar/getAvatar.do?type=sns&width=64&height=64&userIdStr=MmPeO8kLvm8YXm*zMm*eO8c0vFQbv0cSXF-IOmMzvGQT"
}
},
{
"id": "90566746631",
"question_title": "请问这个刀片是可以一按就弹出来,还是要拔出来的丫",
"detail_url": "https://market.m.taobao.com/app/mtb/questions-and-answers/pages/detail/index.html?from=answer&spm=a3134.14087530&id=90566746631",
"total_answer": "4",
"creat_time": "2017-07-13",
"answer_info": {
"id": "90567311785",
"answer_title": "是拔出来的 不能弹出来",
"answer_time": "2017-07-13",
"nick": "成**宝",
"user_logo": "https://wwc.alicdn.com/avatar/getAvatar.do?type=sns&width=64&height=64&userIdStr=P8cGvCIyMGIYO8QWP0kWvmcbMFxbvC*-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"
}
文章内容有限,欢迎私信沟通交流。