通过1688APP分享商品链接淘口令获取商品详情接口,淘口令返利接口,1688淘口令API接口,淘口令解析接口,1688短链接接口接入方案

一、接口参数说明:
通过1688app中分享至PC端的短链接,通过调用item_password - 获得淘口令真实url接口,可以得到转换后的PC端商品链接及商品ID,再次调用商品详情接口即可拿到该淘口令接口要的商品详情数据。
点击获取测试key和secret
在这里插入图片描述二、请求参数:
请求参数:word=https%3A%2F%2Fqr.1688.com%2Fshare.html%3Fsecret=FIH6kmCT&title=no
参数说明:word:淘口令代码
title:是否获取标题和图片
三、响应参数:
名称 类型 示例值 描述
item item[] 商品信息
num_iid String 553327559647 宝贝ID
url String https://detail.1688.com/offer/553327559647.html 淘口令真实url
word String https://qr.1688.com/share.html?secret=FIH6kmCT 淘口令内容
error String error taobao password 错误提示
四、请求示例:(CURL、PHP 、PHPsdk 、Java 、C# 、Python)

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://注册获取完整请求链接/1688/item_password/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&word=https%3A%2F%2Fqr.1688.com%2Fshare.html%3Fsecret=FIH6kmCT&title=no";
		JSONObject json = getRequestFromUrl(url);
		System.out.println(json.toString());
	}

}

响应示例:

{
	"item": {
		"num_iid": "553327559647",
		"url": "https://detail.1688.com/offer/553327559647.html",
		"word": "https://qr.1688.com/share.html?secret=FIH6kmCT",
		"error": ""
	},
	"error": "",
	"reason": "",
	"error_code": "0000",
	"cache": 0,
	"api_info": "today:9 max:10000",
	"execution_time": 1.389,
	"server_time": "Beijing/2021-03-09 17:05:36",
	"client_ip": "106.6.35.144",
	"call_args": [],
	"api_type": "1688",
	"translate_language": "zh-CN",
	"translate_engine": "google_cn",
	"server_memory": "3.47MB",
	"request_id": "gw-3.60473a5ec66b1"
}

API 工具
API SDK调用示例
APISDK下载
API测试工具

如何开通API测试,点击立即开通

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值