商品详情API接口对接电商平台数据获取虾皮shopee产品参数销量、销量、库存、商品规格信息列表调用演示

商品详情API接口是一种用于访问和获取商品信息的接口,通常用于连接电商平台和商家应用程序。这个接口可以提供有关商品的各种详细信息,如名称、价格、描述、图片、类别、库存和评价等。它使得开发者能够为平台上的消费者提供更个性化和定制化的购物体验,例如将商品信息直接显示在应用程序中,或者在移动设备上实现扫码识别商品信息等功能。此外,商品详情API接口还可以帮助商家更好地了解和掌握他们的商品信息,提高销售效率和管理水平。

shopee.item_get-根据ID取商品详情

公共参数

名称类型必须描述
keyString调用key(必须以GET方式拼接在URL中)注册调用key请求接入
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=264070136/5637247041&country=.com.my

参数说明:num_iid:商品ID-country:网站后缀(.com.my;.vn;.ph)

响应参数

Version: Date:

名称类型必须示例值描述

num_iid

Bigint05637247041宝贝ID

title

String0Fashionable plus size womens dress 2020 new spring and summer dress was thin and thin and fat sister dress two-piece suit宝贝标题

price

Float022.17价格

orginal_price

String031.68原价

num

Int03836库存

detail_url

String0https://shopee.com.my/product/264070136/5637247041宝贝链接

pic_url

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

brand

String0No Brand品牌名称

favcount

Int02027

desc

String0

skus

Mix0{"sku": [{"price": "39", "total_price": null, "orginal_price": "39.00", "properties": "0:0", "properties_name": "0:0:T-shirt+skirt:M 建议【42.5-50KG】", "quantity": "305", "sku_id": "3166598625985"}]商品规格信息列表

has_discount

String0true

item_size

String0

cid

Int016

currency

String0MYR

size_chart

String0https://cf.shopee.com.my/file/6105b7c64414c2012908bff679b9321d

sales

Int0138销量

item_imgs

Mix0[{ "url": "https://cf.shopee.com.my/file/f8bc1116ea922e5ed87a492390b1cc1a"}商品图片

discount

String030%

location

String0Mainland China发货地

shop_id

Int0151372205店铺ID

seller_info

Mix0{"nick": "qzq1274334183.my", "city": "Mainland China", "level": 12, "seller_promotion_refresh_time": "2021-01-19 02:00:00", "zhuy": "https://shopee.com.my/shop/264070136/search", "shop_type": "A"}卖家信息

prop_imgs

Mix0[]属性图片

props_list

Mix0{20509:9974422: 尺码:36}商品属性

props_name

String00:0:T-shirt+skirt:M 建议【42.5-50KG】;0:1:T-shirt+skirt:L 建议 【50-57.5kg】;商品属性名

props

Mix0[{ "name": "产地","value": "中国" }]商品详情

current_lang

String0en

currency_code

String0MYR

props_img

Mix01627207:28326": "//img.alicdn.com/imgextra/i2/2844096782/O1CN01VrjpXt1zyCc9DvERE_!!2844096782.jpg属性图片

shop_item

Mix0[]

relate_items

Mix0[]

tmall

Boolean0false是否天猫

error

String0错误信息

warning

String0price_json error;skus miss;警告信息

url_log

Mix0[]

method

String0item_tmall:pget_item

promo_type

String0

Java请求示例(PHP、PHPsdk、JAVA、C#、Python、Golang、javascript、JS-SDK、Ruby、Swift、Objective-C、C、C++、Node.Js、Kotlin、Rust、R、MATLAB...)

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://shopee/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=264070136/5637247041&country=.com.my";
		JSONObject json = getRequestFromUrl(url);
		System.out.println(json.toString());
	}

}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值