• API接口请求电商数据平台参数获取淘宝商品描述示例


    淘宝商品描述详细信息API接口是一个用于获取淘宝商品详细信息的API,通过它可以获取到商品的标题、价格、图片等信息。通过淘宝商品描述详细信息API接口,开发者可以方便地获取宝贝的相关信息,并将它们用于各种应用场景中。淘宝商品描述详细信息API接口可以帮助网站开发者、应用开发者获得淘宝的商品详情信息,从而方便的实现自己的业务需求,同时也能够有效地减少开发其他应用程序的成本费用。

    公共参数

    请求地址: 注册调用key接入

    名称类型必须描述
    keyString调用key(必须以GET方式拼接在URL中)
    secretString调用密钥
    api_nameStringAPI接口名称(包括在请求地址中)[item_search,item_get,item_search_shop等]
    cacheString[yes,no]默认yes,将调用缓存的数据,速度比较快
    result_typeString[json,jsonu,xml,serialize,var_export]返回数据格式,默认为json,jsonu输出的内容中文可以直接阅读
    langString[cn,en,ru]翻译语言,默认cn简体中文
    versionStringAPI版本

    请求参数

    请求参数:num_iid=520813250866

    参数说明:num_iid:淘宝商品ID

    响应参数

    Version: Date:

    名称类型必须示例值描述

    item

    item[]0获得淘宝商品描述

    desc

    String0[]商品描述

    Java请求示例(PHP、PHPsdk、Swift、Curl、JAVA、C#、Python、Golang、javascript、JS-SDK、Ruby、Objective-C、C++...)

    1. import java.io.BufferedReader;
    2. import java.io.IOException;
    3. import java.io.InputStream;
    4. import java.io.InputStreamReader;
    5. import java.io.Reader;
    6. import java.net.URL;
    7. import java.nio.charset.Charset;
    8. import org.json.JSONException;
    9. import org.json.JSONObject;
    10. import java.io.PrintWriter;
    11. import java.net.URLConnection;
    12. public class Example {
    13. private static String readAll(Reader rd) throws IOException {
    14. StringBuilder sb = new StringBuilder();
    15. int cp;
    16. while ((cp = rd.read()) != -1) {
    17. sb.append((char) cp);
    18. }
    19. return sb.toString();
    20. }
    21. public static JSONObject postRequestFromUrl(String url, String body) throws IOException, JSONException {
    22. URL realUrl = new URL(url);
    23. URLConnection conn = realUrl.openConnection();
    24. conn.setDoOutput(true);
    25. conn.setDoInput(true);
    26. PrintWriter out = new PrintWriter(conn.getOutputStream());
    27. out.print(body);
    28. out.flush();
    29. InputStream instream = conn.getInputStream();
    30. try {
    31. BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8")));
    32. String jsonText = readAll(rd);
    33. JSONObject json = new JSONObject(jsonText);
    34. return json;
    35. } finally {
    36. instream.close();
    37. }
    38. }
    39. public static JSONObject getRequestFromUrl(String url) throws IOException, JSONException {
    40. URL realUrl = new URL(url);
    41. URLConnection conn = realUrl.openConnection();
    42. InputStream instream = conn.getInputStream();
    43. try {
    44. BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8")));
    45. String jsonText = readAll(rd);
    46. JSONObject json = new JSONObject(jsonText);
    47. return json;
    48. } finally {
    49. instream.close();
    50. }
    51. }
    52. public static void main(String[] args) throws IOException, JSONException {
    53. // 请求示例 url 默认请求参数已经URL编码处理
    54. String url = "https://taobao/item_get_desc/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=520813250866";
    55. JSONObject json = getRequestFromUrl(url);
    56. System.out.println(json.toString());
    57. }
    58. }

     响应示例

    1. {
    2. "item": {
    3. "desc": "\n http://img.alicdn.com/imgextra/i3/2200639983103/O1CN01B8rO8q1YnDpqtaSHZ_!!2200639983103-1-scmitem6000.gif\" usemap=\"#IUSGU\" />\n IUSGU\">rect\" coords=\"6,10,786,541\" href=\"https://pages.tmall.com/wow/an/cs/act/wupr?wh_biz=tm&amp;wh_pid=3320144%2F17c73fe7b21&amp;disableNav=YES&amp;brandId=3320144&amp;chaoshi_brand_waitou=true\">rect\" coords=\"9,561,169,731\" href=\"https://pages.tmall.com/wow/ark-pub/common/ee30c50a/tpl?wh_sid=a4a7a974fcf99970&amp;mcBrandCard=true\">rect\" coords=\"211,561,371,721\" href=\"https://pages.tmall.com/wow/ark-pub/common/ee30c50a/tpl?wh_sid=b1f371c6cada937b&amp;mcBrandCard=true\">rect\" coords=\"415,562,575,722\" href=\"https://pages.tmall.com/wow/ark-pub/common/ee30c50a/tpl?wh_sid=8fff1d96108c25a3&amp;mcBrandCard=true\">rect\" coords=\"597,563,757,723\" href=\"https://pages.tmall.com/wow/ark-pub/common/ee30c50a/tpl?wh_sid=a4d5dbb8fee520eb&amp;mcBrandCard=true\"> \n http://img.alicdn.com/imgextra/i3/2200639983103/O1CN01MdspcQ1YnDpofKaYI_!!2200639983103-1-scmitem6000.gif\" usemap=\"#EMBND\" />\n EMBND\">rect\" coords=\"3,253,355,792\" href=\"https://chaoshi.detail.tmall.com/item.htm?id=627358747270&amp;skuId=4958439969412\"> \n

       

      \n

       

      \n

       

      \n

       

      \n

       

      \n

       

      \n

       http://img.alicdn.com/imgextra/i4/2200639983103/O1CN01K5mRzF1YnDhfbLqYO_!!2200639983103-0-scmitem6000.jpg\" align=\"absmiddle\" />

      \n

       

      \n

      GPSIJ\">rect\" coords=\"194,8,374,148\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=536597702698\">rect\" coords=\"377,10,557,148\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=611943282371\">rect\" coords=\"564,15,742,150\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=613199006000\">rect\" coords=\"197,165,372,299\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=602723508607\">rect\" coords=\"382,170,554,305\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=44107699067\">rect\" coords=\"567,165,739,305\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=44187888589\">rect\" coords=\"197,318,374,455\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=533938505960\">rect\" coords=\"386,318,558,453\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=591828039537\">rect\" coords=\"567,318,741,460\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=566408329269\">rect\" coords=\"196,470,371,606\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=533971548851\">rect\" coords=\"380,473,557,610\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=577183292025\">rect\" coords=\"565,470,740,613\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=573075979265\">rect\" coords=\"197,622,262,676\" href=\"\">rect\" coords=\"199,624,374,758\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=554419816039\">rect\" coords=\"381,620,556,762\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=592956242653\">rect\" coords=\"564,623,739,764\" href=\"https://chaoshi.detail.tmall.com/item.htm?spm=a1z34w.13877023.0.0.626531a5VcC2US&amp;id=604301910718\">

      \n

      https://chaoshi.detail.tmall.com/item.htm?spm=a220o.7406545.0.0.32c7697bmJA9L1&amp;id=590048908797\" target=\"_blank\">

      \n

      http://img.alicdn.com/imgextra/i3/2200639983103/O1CN01UzEW4I1YnDhVdkEFJ_!!2200639983103-0-scmitem6000.jpg\" align=\"absmiddle\" />

      \n

       

      \n

      http://img.alicdn.com/imgextra/i3/2200639983103/O1CN016eKqLt1YnDnXbDcWs_!!2200639983103-0-scmitem6000.jpg\" align=\"absmiddle\" />http://img.alicdn.com/imgextra/i2/2200639983103/O1CN01GDW3H61YnDnhPYxl7_!!2200639983103-0-scmitem6000.jpg\" align=\"absmiddle\" />absmiddle\" src=\"http://img.alicdn.com/imgextra/i2/3596645218/O1CN01seMU6n1oPt9fOvcj4_!!3596645218-0-scmitem6000.jpg\" />http://img.alicdn.com/imgextra/i2/2200639983103/O1CN0162Bmh21YnDnaPMaTM_!!2200639983103-0-scmitem6000.jpg\" align=\"absmiddle\" />absmiddle\" src=\"http://img.alicdn.com/imgextra/i3/3596645218/O1CN01f4fzGM1oPt9XJ7Hk2_!!3596645218-0-scmitem6000.jpg\" />absmiddle\" src=\"http://img.alicdn.com/imgextra/i4/3596645218/O1CN01rWjGD61oPt9fgZiT4_!!3596645218-0-scmitem6000.jpg\" />http://img.alicdn.com/imgextra/i2/2200639983103/O1CN01DfHuV61YnDjRoGnAQ_!!2200639983103-0-scmitem6000.jpg\" align=\"absmiddle\" />http://img.alicdn.com/imgextra/i3/2200639983103/O1CN01QZgCx01YnDjXm4Y03_!!2200639983103-0-scmitem6000.jpg\" align=\"absmiddle\" />absmiddle\" src=\"http://img.alicdn.com/imgextra/i3/2142811280/O1CN01WxEC6x1LKHSoigkL0_!!2142811280-0-scmitem6000.jpg\" />absmiddle\" src=\"http://img.alicdn.com/imgextra/i2/2200639983103/O1CN01CzM2ro1YnDUFRy4lH_!!2200639983103-0-scmitem6000.jpg\" />http://img.alicdn.com/imgextra/i3/2200639983103/O1CN01hy4eW41YnDnoTFBOb_!!2200639983103-0-scmitem6000.jpg\" align=\"absmiddle\" />

        \n

       

      \n

       

      \n \n "
      ,
    4. "data_from": "app_vip"
    5. },
    6. "error": "",
    7. "reason": "",
    8. "error_code": "0000",
    9. "cache": 0,
    10. "api_info": "today:24 max:10000 all[39=24+0+15];expires:2030-12-31",
    11. "execution_time": "0.666",
    12. "server_time": "Beijing/2023-06-21 09:18:44",
    13. "client_ip": "115.153.49.96",
    14. "call_args": [],
    15. "api_type": "taobao",
    16. "translate_language": "zh-CN",
    17. "translate_engine": "baidu",
    18. "server_memory": "0.86MB",
    19. "request_id": "gw-4.64924ff43c9b9",
    20. "last_id": "1821985889"
    21. }
  • 相关阅读:
    状压dp+二分
    #php的pecl工具#
    [go]gg库绘图与添加文字
    markdown文档管理工具
    链表高频笔试的OJ题
    并发编程:使用Scala Future和Akka实现并发处理
    轻松学会结构栈
    记一个src中危-图像大小与请求参数可修改
    MYSQL正则表达式函数详解和实战
    C++的入门
  • 原文地址:https://blog.csdn.net/2301_78671173/article/details/133295626