Java代码虾皮item_search-根据关键词获取商品列表 API 接口(title商品标题、pic_url宝贝图片、detail_url宝贝链接、shop_id店铺ID、num_iid宝贝ID等

Shopee店铺运营技巧与JavaAPI调用示例,

Shopee是东南亚最大的电商平台之一。Shopee拥有商品种类,包括电子消费品、家居、美容保健、母婴、服饰及健身器材等。

做好shopee店铺需要注意以下几点:1.选择优质的产品 2.每日上新产品 3.营销策略 4.引流策略5.发货的地点

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://v-x-;18870288846/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&q=dress&page=1&sort=&country=.com.my";
		JSONObject json = getRequestFromUrl(url);
		System.out.println(json.toString());
	}

}

 请求参数

请求参数:q=dress&page=1&sort=&country=.com.my

参数说明:q:搜索关键词-country:网站后缀(.com.my;.vn;.ph),
sort:排序[bid,_bid,_sale,new]
  (bid:总价,sale:销量,new:新品,加_前缀为从大到小排序)
page:页数

响应参数

Version: Date:

名称类型必须示例值描述

items

item[]0获取商品列表根据关键词取商品列表

title

String0Real Shot Long Dress Female Summer New Womens Waist Slimming Dress Summer Temperament Dress Popular Fake Two-Piece Dres商品标题

pic_url

String0https://cf.shopee.com.my/file/902d7fd4f24d056d89163e4f32fcc8c2宝贝图片

promotion_price

Float082.00优惠价

price_range

Float00折扣价

price

Float082.00价格

sales

Int00销量

num_iid

Bigint0334425154/8200081234宝贝ID

shop_id

Bigint0334425154店铺ID

area

String0Kuala Lumpur店铺所在地

detail_url

String0https://shopee.com.my/product/334425154/8200081234宝贝链接

文章内容有限,欢迎广大码友私信沟通交流!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值