调用示例
curl
curl -X POST 'https://api.sopei.cn/api/sopei/openservice/v1.0/partsku/vin/precise' \
-H 'Authorization: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"vin": "LSGUL8AL0LA144652",
"categories": [
{
"category_code": "G0001",
"ten_brand_code": "47657eeceaae67f8"
}
],
"keyword": "",
"cm_model_year": "2020",
"cm_engine_start_stop": "有"
}'
Python
import requests
url = "https://api.sopei.cn/api/sopei/openservice/v1.0/partsku/vin/precise"
headers = {
"Authorization": "YOUR_API_KEY",
"Content-Type": "application/json",
}
payload = {
"vin": "LSGUL8AL0LA144652",
"categories": [
{
"category_code": "G0001",
"ten_brand_code": "47657eeceaae67f8"
}
],
"keyword": "",
"cm_model_year": "2020",
"cm_engine_start_stop": "有"
}
print(requests.post(url, headers=headers, json=payload).json())
JavaScript
const payload = {
"vin": "LSGUL8AL0LA144652",
"categories": [
{
"category_code": "G0001",
"ten_brand_code": "47657eeceaae67f8"
}
],
"keyword": "",
"cm_model_year": "2020",
"cm_engine_start_stop": "有"
};
const res = await fetch("https://api.sopei.cn/api/sopei/openservice/v1.0/partsku/vin/precise", {
method: "POST",
headers: {
Authorization: "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
});
console.log(await res.json());
Java
String json = "{\n \"vin\": \"LSGUL8AL0LA144652\",\n \"categories\": [\n {\n \"category_code\": \"G0001\",\n \"ten_brand_code\": \"47657eeceaae67f8\"\n }\n ],\n \"keyword\": \"\",\n \"cm_model_year\": \"2020\",\n \"cm_engine_start_stop\": \"有\"\n}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.sopei.cn/api/sopei/openservice/v1.0/partsku/vin/precise"))
.header("Authorization", "YOUR_API_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
PHP
<?php
$ch = curl_init("https://api.sopei.cn/api/sopei/openservice/v1.0/partsku/vin/precise");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
"Authorization: YOUR_API_KEY",
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => '{
"vin": "LSGUL8AL0LA144652",
"categories": [
{
"category_code": "G0001",
"ten_brand_code": "47657eeceaae67f8"
}
],
"keyword": "",
"cm_model_year": "2020",
"cm_engine_start_stop": "有"
}',
]);
echo curl_exec($ch);
成功响应
{
"code": 0,
"msg": "OK",
"status": "ok",
"data": {
"result_type": "CARMODELS",
"carmodels": [
{
"cm_brand": "别克",
"cm_factory": "上汽通用别克",
"cm_car": "GL8",
"cm_model": "GL8 Avenir",
"cm_displacement": "2.0T",
"cm_fuel_type": "汽油"
}
],
"partsku_groups": []
}
}
失败响应
{
"code": 4003,
"msg": "ParametersError",
"status": "fail",
"error": "无效的车架号(vin)"
}