using System;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json.Linq;
//await Vin.GearboxAsync(21617);
class Vin
{
// 替换成你的AppKey
private const string AppKey = "YOUR_APPKEY_HERE";
public static async Task GearboxAsync(int carid)
{
try
{
using (HttpClient client = new HttpClient())
{
// 构造请求URL
string url = $"https://api.jisuapi.com/vin/gearbox?appkey={AppKey}&carid={carid}";
// 发送GET请求
HttpResponseMessage response = await client.GetAsync(url);
// 确保成功响应
response.EnsureSuccessStatusCode();
// 读取响应内容
string responseBody = await response.Content.ReadAsStringAsync();
JObject result = JObject.Parse(responseBody);
// 处理API返回状态
if ((int)result["status"] == 0)
{
// 解析信息
JToken data = result["result"];
Console.WriteLine(data["carid"]+" "+data["brandname"]+" "+data["parentname"]);
Console.WriteLine(data["name"]+" "+data["price"]+" "+data["yeartype"]);
Console.WriteLine(data["listdate"]+" "+data["productionstate"]+" "+data["salestate"]+" "+data["sizetype"]);
JToken gearbox = data["gearboxinfo"];
Console.WriteLine(gearbox["gearboxmodel"]+" "+gearbox["gearboxbrand"]+" "+gearbox["joint"]+" "+gearbox["level"]+" "+gearbox["gravityoil"]+" "+gearbox["mechanicaloil"]);
foreach (var item in gearbox["jointpiclist"])
{
Console.WriteLine($"{item}");
}
foreach (var item in gearbox["positionpiclist"])
{
Console.WriteLine($"{item}");
}
}
else
{
Console.WriteLine($"查询失败:{result["status"]} {result["msg"]}");
}
}
}
catch (HttpRequestException ex)
{
Console.WriteLine($"请求异常:{ex.Message}");
}
catch (Exception ex)
{
Console.WriteLine($"发生错误:{ex.Message}");
}
}
static async Task Main(string[] args)
{
//await GearboxAsync(21617);
}
} 

© 2015-2025 杭州极速互联科技有限公司 版权所有 浙ICP备17047587号-4 浙公网安备33010502005096 增值电信业务经营许可证:浙B2-20190875