lazada获得lazada商品详情API 返回值说明

31 阅读2分钟

公共参数

请求地址: api-gw.onebound.cn/lazada/item…

名称类型必须描述
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=267690734&nation=co.th

参数说明:num_iid:lazada商品ID(是对应国家不同国家的ID不能通用)
nation:国家
国家域名后缀可选值如下:co.id、com.my、com.ph、sg、co.th、vn

响应参数

Version: Date:

名称类型必须示例值描述
itemitem[]0获得lazada商品详情
num_iidString0267690734宝贝ID
titleString0中国新年假期交付63年2月2日!!城市豪宅鞋鞋高跟鞋男士正商务正装男士鞋鞋牛津牛津向左急转福特男性电影ShoeFree。商品标题
priceFloat07.70价格
nickString0URBAN SAFARI卖家昵称
pic_urlString0//my-test-11.slatic.net/original/208de91b5132477f8a723c82c56c3a58.jpg宝贝图片
detail_urlString0www.lazada.co.th/products/2-…宝贝链接
brandString0MAJE品牌
orginal_priceFloat07.70原价
skusMix0{"sku": [{"properties": "0:0", "properties_name": "0:0:颜色:小号", "price": "7.70", "orginal_price": "7.70", "quantity": 716, "sku_id": 3184603612387 }]}商品规格信息列表
props_nameString00:0:小号:;0:1:中号:;0:2:大号:商品属性名
props_imgMix0属性图片
item_imgsMix0[{"url": "//my-test-11.slatic.net/original/208de91b5132477f8a723c82c56c3a58.jpg"}]商品图片列表
sellerMix0
descString0
props_listMix0{"0:0": "颜色:小号"}商品属性
seller_infoMix0{"level": "", "shop_type": "A", "user_num_id": "2620712400", "cid": null, "delivery_score": null, "item_score": null, "score_p": null, "city": "广东 广州", "shop_name": "深圳市福田区尚我佳日用制品厂", "nick": "尚我佳日用品厂", "zhuy": "m.1688.com/winport/b2b…", "sid": "b2b-262071240083f4c"}卖家信息
numInt02191
post_feeFloat09.00邮费
languageString0th
currency_codeString0THB
property_aliasString00:0:小号;0:1:中号;0:2:大号属性别名

请求示例

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-gw.onebound.cn/lazada/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=267690734&nation=co.th";
		JSONObject json = getRequestFromUrl(url);
		System.out.println(json.toString());
	}

}