苏宁商品详情API接口(商品详情页数据接口)

苏宁商品详情API接口代码对接如下:

1.公共参数

名称 类型 必须 描述
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版本

2.请求参数

请求参数:num_iid=0070134261/703410301

参数说明:num_iid:店铺ID/商品ID 

3.请求示例(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://wx19970108018/suning/item_get/?key=<您自己的apiKey>&secret=<您自己的apiSecret>&num_iid=0070134261/703410301";
		JSONObject json = getRequestFromUrl(url);
		System.out.println(json.toString());
	}

}

 4.响应示例

{
	"item": {
		"num_iid": "0070134261/703410301",
		"title": "罗技(Logitech) M235 无线光电鼠标2代 升级优联技术台式笔记本电脑无线办公省电鼠标 (灰色)",
		"desc_short": "",
		"price": "45.00",
		"total_price": 0,
		"suggestive_price": 0,
		"orginal_price": "",
		"nick": null,
		"num": "99",
		"min_num": 0,
		"detail_url": "http://product.suning.com/0070134261/703410301.html",
		"pic_url": "//image.suning.cn/uimg/b2c/newcatentries/0070134261-000000000703410301_1.jpg_400w_400h_4e",
		"brand": null,
		"brandId": null,
		"rootCatId": null,
		"cid": null,
		"crumbs": {
			"0": "电脑/办公/外设",
			"157237": "电脑外设",
			"157250": "鼠标"
		},
		"created_time": "",
		"modified_time": "",
		"delist_time": "",
		"desc": "",
		"desc_img": [
			"https://image.suning.cn/uimg/sop/commodity/180469403026839773750900_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/829807810124167623648200_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/186865161514348058123327_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/131542364233716381943090_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/763953680205707567428220_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/414487999203006843787490_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/861748885456060517999000_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/953397344178553966030960_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/210232585971362766796270_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/101179711710153822981808_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/199857039911322248487598_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/957732684206097424622610_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/181933260774892681354540_x.jpg",
			"//image.suning.cn/uimg/sop/commodity/213219414110141579504563_x.jpg"
		],
		"item_imgs": [
			{
				"url": "//image.suning.cn/uimg/b2c/newcatentries/0070134261-000000000703410301_1.jpg_800w_800h_4e"
			},
			{
				"url": "//image.suning.cn/uimg/b2c/newcatentries/0070134261-000000000703410301_2.jpg_800w_800h_4e"
			},
			{
				"url": "//image.suning.cn/uimg/b2c/newcatentries/0070134261-000000000703410301_3.jpg_800w_800h_4e"
			},
			{
				"url": "//image.suning.cn/uimg/b2c/newcatentries/0070134261-000000000703410301_4.jpg_800w_800h_4e"
			},
			{
				"url": "//image.suning.cn/uimg/b2c/newcatentries/0070134261-000000000703410301_5.jpg_800w_800h_4e"
			}
		],
		"item_weight": "",
		"item_size": "",
		"location": "",
		"post_fee": "",
		"express_fee": "",
		"ems_fee": "",
		"shipping_to": "",
		"has_discount": "",
		"video": [],
		"is_virtual": "",
		"sample_id": "",
		"is_promotion": "",
		"props_name": "0:0:颜色:罗技M170灰色;0:1:颜色:罗技M170蓝色;0:2:颜色:罗技M170红色;0:3:颜色:罗技M171黑色;0:4:颜色:罗技M171蓝色;0:5:颜色:罗技M171红色;0:6:颜色:罗技M186黑色灰边;0:7:颜色:罗技M186黑色红边;0:8:颜色:罗技M186黑色蓝边;0:9:颜色:罗技M235黑色;0:10:颜色:罗技M280黑色;0:11:颜色:罗技M280蓝色;0:12:颜色:罗技M280红色;0:13:颜色:罗技M280灰色;0:14:颜色:罗技M325黑色;0:15:颜色:罗技M650黑色;0:16:颜色:罗技M650白色;0:17:颜色:罗技M650粉色;0:18:颜色:罗技M650L黑色;0:19:颜色:罗技M650L白色",
		"prop_imgs": {
			"prop_img": []
		},
		"property_alias": "0:0:罗技M170灰色;0:1:罗技M170蓝色;0:2:罗技M170红色;0:3:罗技M171黑色;0:4:罗技M171蓝色;0:5:罗技M171红色;0:6:罗技M186黑色灰边;0:7:罗技M186黑色红边;0:8:罗技M186黑色蓝边;0:9:罗技M235黑色;0:10:罗技M280黑色;0:11:罗技M280蓝色;0:12:罗技M280红色;0:13:罗技M280灰色;0:14:罗技M325黑色;0:15:罗技M650黑色;0:16:罗技M650白色;0:17:罗技M650粉色;0:18:罗技M650L黑色;0:19:罗技M650L白色",
		"props": [
			{
				"name": "品牌",
				"value": "罗技(Logitech)"
			},
			{
				"name": "鼠标产品类型",
				"value": "办公鼠标,蓝牙鼠标"
			},
			{
				"name": "产品型号",
				"value": "罗技M235"
			},
			{
				"name": "颜色",
				"value": "灰色"
			},
			{
				"name": "适用类型",
				"value": "笔记本便携,办公"
			},
			{
				"name": "供电模式",
				"value": "五号电池"
			},
			{
				"name": "鼠标接口",
				"value": "USB"
			},
			{
				"name": "工作方式",
				"value": "光电"
			},
			{
				"name": "人体工学",
				"value": "是"
			},
			{
				"name": "按键数",
				"value": "2"
			}
		],
		"total_sold": "",
		"skus": {
			"sku": [
				{
					"price": "45.00",
					"orginal_price": null,
					"properties": "0:0;",
					"properties_name": "0:0:颜色:罗技M170灰色",
					"sku_id": "000000010535842005"
				},
				{
					"price": "45.00",
					"orginal_price": null,
					"properties": "0:1;",
					"properties_name": "0:1:颜色:罗技M170蓝色",
					"sku_id": "000000010535855478"
				},
				{
					"price": "45.00",
					"orginal_price": null,
					"properties": "0:2;",
					"properties_name": "0:2:颜色:罗技M170红色",
					"sku_id": "000000010535847232"
				},
				{
					"price": "49.00",
					"orginal_price": null,
					"properties": "0:3;",
					"properties_name": "0:3:颜色:罗技M171黑色",
					"sku_id": "000000000702044852"
				},
				{
					"price": "49.00",
					"orginal_price": null,
					"properties": "0:4;",
					"properties_name": "0:4:颜色:罗技M171蓝色",
					"sku_id": "000000000702054145"
				},
				{
					"price": "49.00",
					"orginal_price": null,
					"properties": "0:5;",
					"properties_name": "0:5:颜色:罗技M171红色",
					"sku_id": "000000000702050066"
				},
				{
					"price": "49.00",
					"orginal_price": null,
					"properties": "0:6;",
					"properties_name": "0:6:颜色:罗技M186黑色灰边",
					"sku_id": "000000000702296951"
				},
				{
					"price": "49.00",
					"orginal_price": null,
					"properties": "0:7;",
					"properties_name": "0:7:颜色:罗技M186黑色红边",
					"sku_id": "000000000702300333"
				},
				{
					"price": "55.00",
					"orginal_price": null,
					"properties": "0:8;",
					"properties_name": "0:8:颜色:罗技M186黑色蓝边",
					"sku_id": "000000000702301626"
				},
				{
					"price": "79.00",
					"orginal_price": null,
					"properties": "0:9;",
					"properties_name": "0:9:颜色:罗技M235黑色",
					"sku_id": "000000000703410301"
				},
				{
					"price": "69.00",
					"orginal_price": null,
					"properties": "0:10;",
					"properties_name": "0:10:颜色:罗技M280黑色",
					"sku_id": "000000000702191572"
				},
				{
					"price": "69.00",
					"orginal_price": null,
					"properties": "0:11;",
					"properties_name": "0:11:颜色:罗技M280蓝色",
					"sku_id": "000000000702205116"
				},
				{
					"price": "69.00",
					"orginal_price": null,
					"properties": "0:12;",
					"properties_name": "0:12:颜色:罗技M280红色",
					"sku_id": "000000000702208226"
				},
				{
					"price": "69.00",
					"orginal_price": null,
					"properties": "0:13;",
					"properties_name": "0:13:颜色:罗技M280灰色",
					"sku_id": "000000000702210716"
				},
				{
					"price": "89.00",
					"orginal_price": null,
					"properties": "0:14;",
					"properties_name": "0:14:颜色:罗技M325黑色",
					"sku_id": "000000000105021656"
				},
				{
					"price": "229.00",
					"orginal_price": null,
					"properties": "0:15;",
					"properties_name": "0:15:颜色:罗技M650黑色",
					"sku_id": "000000012356492176"
				},
				{
					"price": "229.00",
					"orginal_price": null,
					"properties": "0:16;",
					"properties_name": "0:16:颜色:罗技M650白色",
					"sku_id": "000000012356492094"
				},
				{
					"price": "229.00",
					"orginal_price": null,
					"properties": "0:17;",
					"properties_name": "0:17:颜色:罗技M650粉色",
					"sku_id": "000000012356492144"
				},
				{
					"price": "229.00",
					"orginal_price": null,
					"properties": "0:18;",
					"properties_name": "0:18:颜色:罗技M650L黑色",
					"sku_id": "000000012356492259"
				},
				{
					"price": "229.00",
					"orginal_price": null,
					"properties": "0:19;",
					"properties_name": "0:19:颜色:罗技M650L白色",
					"sku_id": "000000012356492215"
				}
			]
		},
		"seller_id": "",
		"sales": 0,
		"shop_id": "70134261",
		"props_list": {
			"0:0": "颜色:罗技M170灰色",
			"0:1": "颜色:罗技M170蓝色",
			"0:2": "颜色:罗技M170红色",
			"0:3": "颜色:罗技M171黑色",
			"0:4": "颜色:罗技M171蓝色",
			"0:5": "颜色:罗技M171红色",
			"0:6": "颜色:罗技M186黑色灰边",
			"0:7": "颜色:罗技M186黑色红边",
			"0:8": "颜色:罗技M186黑色蓝边",
			"0:9": "颜色:罗技M235黑色",
			"0:10": "颜色:罗技M280黑色",
			"0:11": "颜色:罗技M280蓝色",
			"0:12": "颜色:罗技M280红色",
			"0:13": "颜色:罗技M280灰色",
			"0:14": "颜色:罗技M325黑色",
			"0:15": "颜色:罗技M650黑色",
			"0:16": "颜色:罗技M650白色",
			"0:17": "颜色:罗技M650粉色",
			"0:18": "颜色:罗技M650L黑色",
			"0:19": "颜色:罗技M650L白色"
		},
		"seller_info": {
			"nick": null,
			"city": null,
			"shopid": "70134261",
			"shopname": null,
			"title": null,
			"zhuy": "https://shop.suning.com/70134261/index.html",
			"tel": null
		},
		"tmall": "false",
		"error": "",
		"warning": "",
		"url_log": [],
		"sold": null,
		"props_img": [],
		"shopinfo": {
			"shop_name": null
		},
		"format_check": "ok",
		"shop_item": [],
		"relate_items": []
	},
	"error": "",
	"secache": "18f19fa8b522b37c105e7cfb8a9c5b9d",
	"secache_time": 1657762129,
	"secache_date": "2022-07-14 09:28:49",
	"translate_status": "error",
	"translate_time": 0.001,
	"language": {
		"current_lang": "cn",
		"source_lang": "zh-CN"
	},
	"reason": "",
	"error_code": "0000",
	"cache": 0,
	"api_info": "today:159 max:10100 all[294=159+85+51];expires:2030-12-31",
	"execution_time": "6.764",
	"server_time": "Beijing/2022-07-14 09:28:49",
	"client_ip": "106.6.38.1",
	"call_args": {
		"num_iid": "0070134261/703410301"
	},
	"api_type": "suning",
	"translate_language": "zh-CN",
	"translate_engine": "google_new",
	"server_memory": "0.9MB",
	"request_id": "gw-4.62cf714ac2cb2",
	"last_id": "1076943013"
}

你可能感兴趣的:(苏宁平台API接口开发系列,大数据,苏宁商品详情API接口,苏宁APP商品详情API接口)