首页 VIN车辆识别代码查询 VIN车辆识别代码查询示例代码 VIN查询[Java]

VIN查询示例代码[Java]

作者:xiezhongpian 阅读数:2534 上传时间:2017-05-09

VIN查询

package api.jisuapi.vin;

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/vin/query";
	public static final String vin = "LSVAL41Z882104202";

	public static void Get() {
		String result = null;
		String url = URL + "?appkey=" + APPKEY + "&vin=" + vin;

		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 manufacturer = resultarr.getString("manufacturer");
				String brand = resultarr.getString("brand");
				String cartype = resultarr.getString("cartype");
				String name = resultarr.getString("name");
				String yeartype = resultarr.getString("yeartype");
				String environmentalstandards = resultarr.getString("environmentalstandards");
				String comfuelconsumption = resultarr.getString("comfuelconsumption");
				String engine = resultarr.getString("engine");
				String gearbox = resultarr.getString("gearbox");
				String drivemode = resultarr.getString("drivemode");
				String carbody = resultarr.getString("carbody");
				String fronttiresize = resultarr.getString("fronttiresize");
				String reartiresize = resultarr.getString("reartiresize");
				String vin = resultarr.getString("vin");
				System.out.println(manufacturer + " " + brand + " " + cartype + " " + name + " " + yeartype + " "
						+ environmentalstandards + " " + comfuelconsumption + " " + engine + " " + gearbox + " "
						+ drivemode + " " + carbody + " " + fronttiresize + " " + reartiresize + " " + vin);
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}