package api.jisuapi.barcode2; import api.util.HttpUtil; import net.sf.json.JSONObject; public class Query { public static final String APPKEY = "your_appkey_here";// 你的appkey public static final String URL = "https://api.jisuapi.com/barcode2/query"; public static final String barcode = "06953502812005"; public static void Get() { String result = null; String url = URL + "?appkey=" + APPKEY + "&barcode=" + barcode; try { result = HttpUtil.sendGet(url, "utf-8"); JSONObject json = JSONObject.fromObject(result); if (json.getInt("status") != 0) { System.out.println(json.getString("msg")); } else { JSONObject resultarr = json.optJSONObject("result"); String barcode = resultarr.getString("barcode"); String name = resultarr.getString("name"); String ename = resultarr.getString("ename"); String unspsc = resultarr.getString("unspsc"); String brand = resultarr.getString("brand"); String specification = resultarr.getString("specification"); String width = resultarr.getString("width"); String height = resultarr.getString("height"); String depth = resultarr.getString("depth"); String origincountry = resultarr.getString("origincountry"); String originplace = resultarr.getString("originplace"); String assemblycountry = resultarr.getString("assemblycountry"); String barcodetype = resultarr.getString("barcodetype"); String catena = resultarr.getString("catena"); String isbasicunit = resultarr.getString("isbasicunit"); String packagetype = resultarr.getString("packagetype"); String grossweight = resultarr.getString("grossweight"); String netcontent = resultarr.getString("netcontent"); String netweight = resultarr.getString("netweight"); String description = resultarr.getString("description"); String keyword = resultarr.getString("keyword"); String pic = resultarr.getString("pic"); String price = resultarr.getString("price"); String licensenum = resultarr.getString("licensenum"); String healthpermitnum = resultarr.getString("healthpermitnum"); System.out.println(barcode + " " + name + " " + ename + " " + unspsc + " " + brand + " " + specification + " " + width + " " + height + " " + depth + " " + origincountry + " " + originplace + " " + assemblycountry + " " + barcodetype + " " + catena + " " + isbasicunit + " " + packagetype + " " + grossweight + " " + netcontent + " " + netweight + " " + description + " " + keyword + " " + pic + " " + price + " " + licensenum + " " + healthpermitnum); } } catch (Exception e) { e.printStackTrace(); } } }