阿里巴巴中国站按图搜索1688商品(拍立淘) API 返回值说明
2023-12-13 09:43:06
    		item_search_img-按图搜索1688商品(拍立淘)
1688.item_search_img
公共参数? ?点此获取key
| 名称 | 类型 | 必须 | 描述 | 
|---|---|---|---|
| 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版本 | 
请求参数
请求参数:imgid=http://g-search3.alicdn.com/img/bao/uploaded/i4/O1CN01IDpcD81zHbpHs1YgT_!!2200811456689.jpg
参数说明:imgid:图片地址(使用淘宝upload_img接口上传图片,返回图片地址)
 如:https://img.alicdn.com/imgextra/i3/15353738/TB2HDHAqN9YBuNjy0FfXXXIsVXa_!!15353738-0-beehive-scenes.jpg
响应参数
Version: Date:
| 名称 | 类型 | 必须 | 示例值 | 描述 | 
|---|---|---|---|---|
| items | items[] | 0 | 按图搜索1688商品 | |
| real_total_results | Int | 0 | 80 | 宝贝真实数量 | 
| total_results | Int | 0 | 43 | 搜索数量 | 
| pagecount | Int | 0 | 1 | 总页数 | 
| error | String | 0 | 错误代码 | |
| data_from | String | 0 | ||
| item | item[] | 0 | 宝贝详情数据 | |
| title | String | 0 | 外贸儿童短袖T恤 夏季热销套装 时尚儿童T | 宝贝标题 | 
| pic_url | String | 0 | https://cbu01.alicdn.com/img/ibank/2016/998/799/2913997899_1588191881.jpg | 宝贝图片 | 
| price | Float | 0 | 7.00 | 价格 | 
| sales | Int | 0 | 5 | 销量 | 
| num_iid | Bigint | 0 | 529502304128 | 宝贝ID | 
| turnHead | String | 0 | 23.5% | 回头率 | 
| seller_nick | String | 0 | 中山市汇锦制衣有限公司 | 卖家昵称 | 
| area | String | 0 | 广东中山市 | 店铺所在地 | 
| detail_url | String | 0 | https://detail.1688.com/offer/529502304128.html | 宝贝链接 | 
请求示例
curl
-- 请求示例 url 默认请求参数已经URL编码处理 curl -i "https://api-gw.seaver.cn/1688/item_search_img/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&imgid=http://g-search3.alicdn.com/img/bao/uploaded/i4/O1CN01IDpcD81zHbpHs1YgT_!!2200811456689.jpg"
PHP
<?php
// 请求示例 url 默认请求参数已经URL编码处理
// 本示例代码未加密secret参数明文传输,若要加密请参考:https://open.onebound.cn/help/demo/sdk/demo-sign.php
$method = "GET";
$url = "https://api-seaver.cn/1688/item_search_img/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&imgid=http://g-search3.alicdn.com/img/bao/uploaded/i4/O1CN01IDpcD81zHbpHs1YgT_!!2200811456689.jpg";
$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_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_HEADER, true);
curl_setopt($curl, CURLOPT_ENCODING, "gzip");
var_dump(curl_exec($curl));
?>Python
# coding:utf-8
"""
Compatible for python2.x and python3.x
requirement: pip install requests
"""
from __future__ import print_function
import requests
# 请求示例 url 默认请求参数已经做URL编码
url = "https://api-seaver.cn/1688/item_search_img/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&imgid=http://g-search3.alicdn.com/img/bao/uploaded/i4/O1CN01IDpcD81zHbpHs1YgT_!!2200811456689.jpg"
headers = {
    "Accept-Encoding": "gzip",
    "Connection": "close"
}
if __name__ == "__main__":
    r = requests.get(url, headers=headers)
    json_obj = r.json()
    print(json_obj)?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-seaver.cn/1688/item_search_img/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&imgid=http://g-search3.alicdn.com/img/bao/uploaded/i4/O1CN01IDpcD81zHbpHs1YgT_!!2200811456689.jpg";
		JSONObject json = getRequestFromUrl(url);
		System.out.println(json.toString());
	}
}?
    			文章来源:https://blog.csdn.net/Jernnifer_mao/article/details/134880727
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!
    	本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。 如若内容造成侵权/违法违规/事实不符,请联系我的编程经验分享网邮箱:veading@qq.com进行投诉反馈,一经查实,立即删除!