@dalehkx/quote-cli 0.3.4 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/quote.js +2 -0
- package/package.json +5 -2
- package/scripts/prepack.cjs +40 -0
- package/skill/SKILL.md +222 -0
- package/skill/agents/openai.yaml +7 -0
- package/skill/references/api-mapping.md +596 -0
- package/skill/references/data-schema.md +111 -0
- package/skill/references/inquiry-api-guide.md +749 -0
- package/skill/references/inquiry-flow.md +191 -0
- package/skill/references/workflow.md +78 -0
- package/src/adapter/api.mjs +529 -43
- package/src/auth.mjs +32 -6
- package/src/commands/inquiry.mjs +37 -8
- package/src/commands/install.mjs +162 -0
- package/src/commands/login.mjs +4 -14
- package/src/commands/order.mjs +224 -16
- package/src/constants.mjs +3 -2
|
@@ -0,0 +1,749 @@
|
|
|
1
|
+
# Inquiry API Guide — Casstime terminal-api-v2
|
|
2
|
+
|
|
3
|
+
Base URL: `https://ec-hwbeta.casstime.com/terminal-api-v2`
|
|
4
|
+
|
|
5
|
+
All requests require:
|
|
6
|
+
```
|
|
7
|
+
Authorization: bearer {accessToken}
|
|
8
|
+
User-Agent: cassapp/7.9.0.0 iOS/26.5 Apple/iPhone 13
|
|
9
|
+
Content-Type: application/json
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## 1. Account Requirements & Permissions
|
|
15
|
+
|
|
16
|
+
The platform distinguishes three tiers of users for inquiry creation:
|
|
17
|
+
|
|
18
|
+
| Condition | Can Create Inquiry? | Route |
|
|
19
|
+
|-----------|-------------------|-------|
|
|
20
|
+
| `authenticated: Y` (认证用户) | Yes, unlimited | `POST /inquiries` (full) or `POST /inquiries/simple_inquiry` |
|
|
21
|
+
| `authenticated: N`, `remaining > 0` | Yes, limited quota | Same endpoints; quota tracked via `remain_inquiry_number` |
|
|
22
|
+
| `authenticated: N`, `remaining = 0` | No — must authenticate | Returns error 654 |
|
|
23
|
+
| `isSimpleInquiryAllowed: false` | Simple inquiry blocked | Must use full `POST /inquiries` |
|
|
24
|
+
|
|
25
|
+
The current test account has:
|
|
26
|
+
- `authenticated: N` (未认证)
|
|
27
|
+
- `remaining inquiries: 5` (有剩余次数,可以询价)
|
|
28
|
+
- `isSimpleInquiryAllowed: false` (简易询价不允许,需要使用完整询价接口)
|
|
29
|
+
- `registerCompleted: true`
|
|
30
|
+
|
|
31
|
+
**Key insight:** `isSimpleInquiryAllowed: false` means `POST /inquiries/simple_inquiry` will likely return `654` ("当前账号未认证,需补充相关资料认证后才可继续询价"). The correct path for this account is the full `POST /inquiries` endpoint, which uses a different required fields schema and also needs a valid `carBrandId`.
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 2. Endpoint Reference
|
|
36
|
+
|
|
37
|
+
### 2.1 Check Remaining Inquiry Count
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
GET /inquiries/remain_inquiry_number
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
No parameters required. Returns remaining quota for unauthenticated users.
|
|
44
|
+
|
|
45
|
+
**Response schema:**
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"errorCode": 0,
|
|
49
|
+
"data": {
|
|
50
|
+
"inquiryRemainNumber": 5,
|
|
51
|
+
"isCanShare": false
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
**Error codes:**
|
|
57
|
+
| Code | Meaning |
|
|
58
|
+
|------|---------|
|
|
59
|
+
| 605 | 非法入参 |
|
|
60
|
+
| 999 | 询价服务异常 |
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### 2.2 Get All Brand Qualities (品质列表)
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
GET /inquiries/all_brand_qualities
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
No parameters. Returns full list of quality codes and names.
|
|
71
|
+
|
|
72
|
+
**Response:**
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"errorCode": 0,
|
|
76
|
+
"data": {
|
|
77
|
+
"qualities": [
|
|
78
|
+
{ "qualityId": "ORIGINAL_BRAND", "qualityName": "原厂件" },
|
|
79
|
+
{ "qualityId": "ORIGINAL_CURRENCY", "qualityName": "原厂通货" },
|
|
80
|
+
{ "qualityId": "ORIGINAL_INLAND_4S", "qualityName": "原厂4S" },
|
|
81
|
+
{ "qualityId": "EXTERNAL_BRAND", "qualityName": "外贸件" },
|
|
82
|
+
{ "qualityId": "INTERNAL_BRAND", "qualityName": "内贸件" },
|
|
83
|
+
{ "qualityId": "BRAND", "qualityName": "品牌件" },
|
|
84
|
+
{ "qualityId": "ORIGINAL_OTHERS", "qualityName": "其他原厂" },
|
|
85
|
+
{ "qualityId": "SECOND_HAND", "qualityName": "拆车件" },
|
|
86
|
+
{ "qualityId": "EQUIVALENT_BRAND", "qualityName": "同质件" },
|
|
87
|
+
{ "qualityId": "OTHER_BRAND", "qualityName": "其他品牌件" }
|
|
88
|
+
]
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Error codes:**
|
|
94
|
+
| Code | Meaning |
|
|
95
|
+
|------|---------|
|
|
96
|
+
| 605 | 非法入参 |
|
|
97
|
+
| 999 | 询价服务异常 |
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
### 2.3 Get User Default Qualities
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
GET /inquiries/brand_qualities
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Returns the user's saved default quality preferences.
|
|
108
|
+
|
|
109
|
+
**Response:** Same schema as `all_brand_qualities` but filtered to user defaults.
|
|
110
|
+
|
|
111
|
+
**POST variant** — set default qualities:
|
|
112
|
+
```
|
|
113
|
+
POST /inquiries/brand_qualities
|
|
114
|
+
```
|
|
115
|
+
Body: array of quality IDs (string[])
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
### 2.4 Get Supported Car Brands
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
GET /inquiries/support_brands
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Returns brands the garage's company is authorized to inquire on. `carBrandCode` from this response maps to `carBrandId` in create inquiry.
|
|
126
|
+
|
|
127
|
+
**Response:**
|
|
128
|
+
```json
|
|
129
|
+
{
|
|
130
|
+
"errorCode": 0,
|
|
131
|
+
"data": [
|
|
132
|
+
{
|
|
133
|
+
"carBrandCode": "BYD",
|
|
134
|
+
"carBrandName": "比亚迪",
|
|
135
|
+
"placeId": "place-001",
|
|
136
|
+
"placeName": "国产",
|
|
137
|
+
"brandLogo": "https://...",
|
|
138
|
+
"initialLetter": "B",
|
|
139
|
+
"isNewBrand": false
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Error codes:**
|
|
146
|
+
| Code | Meaning |
|
|
147
|
+
|------|---------|
|
|
148
|
+
| 605 | 公司ID为空 |
|
|
149
|
+
| 999 | 服务异常 |
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
### 2.5 Get Car Model Info by VIN
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
GET /inquiries/car_models?vin={vin}
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Required: `vin` (string). Decodes VIN and returns brand + model data needed for inquiry creation.
|
|
160
|
+
|
|
161
|
+
**Response:** Array of `CarModel` objects, each with:
|
|
162
|
+
- `carBrandId` — **the ID to use in `CreateInquiry.carBrandId`**
|
|
163
|
+
- `carBrandCode` — brand code string
|
|
164
|
+
- `carBrandName` — brand name
|
|
165
|
+
- `carModelName` — model name
|
|
166
|
+
- `seriesId`, `seriesZh`, `seriesEn` — series info
|
|
167
|
+
- `locationId`, `locationName` — origin (国产/进口)
|
|
168
|
+
- `saleModelCode`, `saleModelName` — sales model
|
|
169
|
+
- `isDefaultBrand` — whether pre-selected
|
|
170
|
+
|
|
171
|
+
**Error codes:**
|
|
172
|
+
| Code | Meaning |
|
|
173
|
+
|------|---------|
|
|
174
|
+
| 605 | VIN码/userID/companyID为空 |
|
|
175
|
+
| 701 | 不支持该VIN码对应的品牌 |
|
|
176
|
+
| 775 | VIN码格式有误 |
|
|
177
|
+
| 999 | 询价服务异常 |
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
### 2.6 Get Filter Conditions for List
|
|
182
|
+
|
|
183
|
+
```
|
|
184
|
+
GET /inquiries/filter_conditions
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
No parameters. Returns inquiry users, status list, inquiry types, and brand list — used for populating search filters on the list screen.
|
|
188
|
+
|
|
189
|
+
**Response:**
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"errorCode": 0,
|
|
193
|
+
"data": {
|
|
194
|
+
"inquiryUsers": [...],
|
|
195
|
+
"inquiryStatus": [...],
|
|
196
|
+
"inquiryTypes": [...],
|
|
197
|
+
"classifiedBrands": { "supportedBrands": [...] }
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
### 2.7 Get Anonymous Setting
|
|
205
|
+
|
|
206
|
+
```
|
|
207
|
+
GET /inquiries/anonymous
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Returns whether the user defaults to anonymous inquiry.
|
|
211
|
+
|
|
212
|
+
**POST variant** — update setting:
|
|
213
|
+
```
|
|
214
|
+
POST /inquiries/anonymous?anonymousType=YES|NO
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
---
|
|
218
|
+
|
|
219
|
+
### 2.8 Get Inquiry Example
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
GET /inquiries/example?key={key}
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
`key` values: `INQUIRY`, `EPC`, `INQUIRYLIST`
|
|
226
|
+
|
|
227
|
+
Returns example data for onboarding/tutorial purposes.
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
### 2.9 Create Simple Inquiry (简易询价)
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
POST /inquiries/simple_inquiry
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
**IMPORTANT for this account:** `isSimpleInquiryAllowed: false` means this endpoint will return `654`. Use `POST /inquiries` (section 2.10) instead.
|
|
238
|
+
|
|
239
|
+
**Required body fields:**
|
|
240
|
+
```json
|
|
241
|
+
{
|
|
242
|
+
"carBrandId": "string (required)",
|
|
243
|
+
"carBrandName": "string (required)",
|
|
244
|
+
"userName": "string (required)",
|
|
245
|
+
"isOpenInvoice": false,
|
|
246
|
+
"qualities": ["BRAND"],
|
|
247
|
+
"source": "ANDROID",
|
|
248
|
+
"isAnonymous": false,
|
|
249
|
+
"provinceGeoId": "string (required)",
|
|
250
|
+
"cityGeoId": "string (required)",
|
|
251
|
+
"countyGeoId": "string (required)",
|
|
252
|
+
"provinceGeoName": "string (required)",
|
|
253
|
+
"cityGeoName": "string (required)",
|
|
254
|
+
"countyGeoName": "string (required)",
|
|
255
|
+
"garageCompanyName": "string (required)",
|
|
256
|
+
"simpleInquiryBatchItems": [
|
|
257
|
+
{
|
|
258
|
+
"mediaType": "TEXT",
|
|
259
|
+
"content": "配件名称",
|
|
260
|
+
"itemNum": 1,
|
|
261
|
+
"description": "附加描述/OE号等"
|
|
262
|
+
}
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
**Optional fields:**
|
|
268
|
+
- `vin` — VIN码
|
|
269
|
+
- `carModelName` — 车型名称
|
|
270
|
+
- `contactNumber` — 联系电话
|
|
271
|
+
- `storeIds` — 指定供应商ID数组
|
|
272
|
+
- `isSelectBrandFlag` — 是否选择品牌
|
|
273
|
+
- `vinPicture` — VIN扫描图片URL
|
|
274
|
+
- `isRequireItemInvoice` — 是否需要对项发票
|
|
275
|
+
- `garageCompanyName` — 公司名称
|
|
276
|
+
- `locationId`/`locationName` — 产地ID/名称
|
|
277
|
+
- `seriesId`, `seriesZh`, `seriesEn` — 车系
|
|
278
|
+
- `saleModelCode`, `saleModelName` — 销售车型
|
|
279
|
+
- `epcModelCode`, `epcModelName` — EPC车型
|
|
280
|
+
- `picDemand` — 图片需求类型数组 (`NAMEPLATE`, `HEADSTOCK`, `TAILSTOCK`, `NONE`)
|
|
281
|
+
- `picDemandUrls` — 图片URL数组
|
|
282
|
+
|
|
283
|
+
**simpleInquiryBatchItems item schema:**
|
|
284
|
+
```json
|
|
285
|
+
{
|
|
286
|
+
"mediaType": "TEXT | PICTURE | AUDIO",
|
|
287
|
+
"content": "文本内容(TEXT类型必填)",
|
|
288
|
+
"url": "图片/语音URL(非TEXT类型使用)",
|
|
289
|
+
"itemNum": 1,
|
|
290
|
+
"description": "描述"
|
|
291
|
+
}
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
**Response:**
|
|
295
|
+
```json
|
|
296
|
+
{
|
|
297
|
+
"errorCode": 0,
|
|
298
|
+
"data": {
|
|
299
|
+
"inquiryId": "询价单ID"
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
**Error codes:**
|
|
305
|
+
| Code | Meaning |
|
|
306
|
+
|------|---------|
|
|
307
|
+
| 654 | 账号未认证,无法继续询价 |
|
|
308
|
+
| 711 | 生成询价单失败 |
|
|
309
|
+
| 999 | 询价服务异常 |
|
|
310
|
+
|
|
311
|
+
---
|
|
312
|
+
|
|
313
|
+
### 2.10 Create Full Inquiry (完整询价)
|
|
314
|
+
|
|
315
|
+
```
|
|
316
|
+
POST /inquiries
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
Use this for authenticated users or when `isSimpleInquiryAllowed: false`.
|
|
320
|
+
|
|
321
|
+
**Required body fields:**
|
|
322
|
+
```json
|
|
323
|
+
{
|
|
324
|
+
"vin": "string",
|
|
325
|
+
"carBrandId": "string",
|
|
326
|
+
"carBrandName": "string",
|
|
327
|
+
"userName": "string",
|
|
328
|
+
"contactNumber": "string",
|
|
329
|
+
"isOpenInvoice": false,
|
|
330
|
+
"source": "ANDROID",
|
|
331
|
+
"isSelectBrandFlag": false,
|
|
332
|
+
"isAnonymous": false,
|
|
333
|
+
"qualities": ["BRAND"],
|
|
334
|
+
"userNeeds": [
|
|
335
|
+
{
|
|
336
|
+
"needsName": "配件名称 (required)",
|
|
337
|
+
"quantity": 1,
|
|
338
|
+
"isFastOe": false,
|
|
339
|
+
"isSuggest": false,
|
|
340
|
+
"imageUrls": [],
|
|
341
|
+
"originalNeed": "原始名称(可选)",
|
|
342
|
+
"inquirySource": "MANUALLY",
|
|
343
|
+
"oeCode": "OE号(可选)",
|
|
344
|
+
"remark": "备注(可选)"
|
|
345
|
+
}
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
**Optional but commonly used:**
|
|
351
|
+
- `carModelName` — 车型名称
|
|
352
|
+
- `noReplacement` — `N` (需要替换件) | `Y` (不需要)
|
|
353
|
+
- `quotedType` — `SYSTEMHANDLER` | `MANHANDLER` | `COMBINATIONHANDLER`
|
|
354
|
+
- `storeIds` — 指定供应商ID数组
|
|
355
|
+
- `provinceGeoId`, `cityGeoId`, `countyGeoId` — 地址省市区ID
|
|
356
|
+
- `provinceGeoName`, `cityGeoName`, `countyGeoName` — 地址省市区名称
|
|
357
|
+
- `locationId`, `locationName` — 产地
|
|
358
|
+
- `seriesId`, `seriesZh`, `seriesEn` — 车系
|
|
359
|
+
- `saleModelCode`, `saleModelName` — 销售车型
|
|
360
|
+
- `isAccidentInquiry` — 是否事故车
|
|
361
|
+
- `remarks` — 事故车备注
|
|
362
|
+
- `tagValue` — 业务规则 (`QUICK_REPAIR`, `REPAIR`, `CUSTOMIZE`)
|
|
363
|
+
- `isInsuranceDirect` — 是否保险直供
|
|
364
|
+
- `type` — `WHOLE_CAR_PARTS` | `TYRE` | `HK_MC_TW_INQUIRY`
|
|
365
|
+
|
|
366
|
+
**userNeeds item required fields:** `needsName`, `quantity`, `isFastOe`, `isSuggest`, `imageUrls`
|
|
367
|
+
|
|
368
|
+
**inquirySource enum:**
|
|
369
|
+
`SELECT`, `ADD`, `MANUALLY`, `ELECTRONIC_CATALOG`, `MANUAL_ENTRY`, `UPDATE_DECODE_ERROR`, `MANUALLY_DECODE_COPY`, `USER_ADD`, `AUXILIARY`
|
|
370
|
+
|
|
371
|
+
**qualities enum:**
|
|
372
|
+
`ORIGINAL_BRAND`, `ORIGINAL_CURRENCY`, `ORIGINAL_INLAND_4S`, `EXTERNAL_BRAND`, `INTERNAL_BRAND`, `BRAND`, `ORIGINAL_OTHERS`, `SECOND_HAND`, `EQUIVALENT_BRAND`, `OTHER_BRAND`
|
|
373
|
+
|
|
374
|
+
**Response:**
|
|
375
|
+
```json
|
|
376
|
+
{
|
|
377
|
+
"errorCode": 0,
|
|
378
|
+
"data": {
|
|
379
|
+
"inquiryId": "询价单ID",
|
|
380
|
+
"isSimpleDemand": false
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
**Error codes:**
|
|
386
|
+
| Code | Meaning |
|
|
387
|
+
|------|---------|
|
|
388
|
+
| 711 | 生成询价单失败(系统繁忙[1711]) |
|
|
389
|
+
| 838 | 不支持7位宝马VIN码 |
|
|
390
|
+
| 999 | 询价服务异常 |
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
### 2.11 Get Inquiry List
|
|
395
|
+
|
|
396
|
+
```
|
|
397
|
+
POST /inquiries/list?page={page}&size={size}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
Required query params: `page` (number), `size` (number)
|
|
401
|
+
|
|
402
|
+
**Request body** (all optional):
|
|
403
|
+
```json
|
|
404
|
+
{
|
|
405
|
+
"searchContext": "关键字",
|
|
406
|
+
"inquiryType": "CUSTOMIZE_INQUIRY",
|
|
407
|
+
"startDate": "2026-01-01",
|
|
408
|
+
"endDate": "2026-06-15",
|
|
409
|
+
"statusIds": ["WAIT_QUOTATION"],
|
|
410
|
+
"createdBys": ["userId1"],
|
|
411
|
+
"carBrandIds": ["brandId1"],
|
|
412
|
+
"isSentry": false,
|
|
413
|
+
"isExclusiveCustomer": false
|
|
414
|
+
}
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
**Status IDs mapping:**
|
|
418
|
+
| CLI status | Platform statusIds |
|
|
419
|
+
|------------|-------------------|
|
|
420
|
+
| pending | `UNQUOTE`, `WAIT_QUOTATION`, `QUOTING`, `IN_THE_DECODING`, `DECODED` |
|
|
421
|
+
| quoted | `QUOTE`, `QUOTED`, `PART_QUOTED` |
|
|
422
|
+
| ordered | `ORDERED` |
|
|
423
|
+
| closed | `IS_CLOSED`, `CLOSED`, `EXPIRED`, `ABATE`, `CANCELED` |
|
|
424
|
+
|
|
425
|
+
**Response:**
|
|
426
|
+
```json
|
|
427
|
+
{
|
|
428
|
+
"errorCode": 0,
|
|
429
|
+
"data": {
|
|
430
|
+
"content": [
|
|
431
|
+
{
|
|
432
|
+
"inquiryId": "IQ-XXXX",
|
|
433
|
+
"carBrandId": "...",
|
|
434
|
+
"carBrandName": "丰田",
|
|
435
|
+
"carModelName": "卡罗拉",
|
|
436
|
+
"userNeed": "前挡风玻璃, 雨刷...",
|
|
437
|
+
"statusId": "WAIT_QUOTATION",
|
|
438
|
+
"statusDesc": "待报价",
|
|
439
|
+
"vin": "LXXXXX",
|
|
440
|
+
"createdName": "张三",
|
|
441
|
+
"createdBy": "userId",
|
|
442
|
+
"createdStamp": 1718000000000,
|
|
443
|
+
"isSimpleInquiry": false,
|
|
444
|
+
"hasNewQuote": false,
|
|
445
|
+
"inquiryDataType": "HOT"
|
|
446
|
+
}
|
|
447
|
+
],
|
|
448
|
+
"totalElements": 50,
|
|
449
|
+
"totalPages": 3,
|
|
450
|
+
"number": 1,
|
|
451
|
+
"size": 20
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
**GET variant** (for supplier side):
|
|
457
|
+
```
|
|
458
|
+
GET /inquiries/list?storeId={storeId}&pageSize={n}&page={n}
|
|
459
|
+
```
|
|
460
|
+
|
|
461
|
+
---
|
|
462
|
+
|
|
463
|
+
### 2.12 Get Inquiry Detail
|
|
464
|
+
|
|
465
|
+
```
|
|
466
|
+
GET /inquiries/{inquiryId}/detailV2?platform=ANDROID
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
Path param: `inquiryId`
|
|
470
|
+
Query params: `platform` (required: `IOS`|`ANDROID`|`PC`), `fromPage` (optional), `isSentry` (optional, default false)
|
|
471
|
+
|
|
472
|
+
Returns comprehensive inquiry detail including vehicle info, needs, quote results.
|
|
473
|
+
|
|
474
|
+
**Simpler variant:**
|
|
475
|
+
```
|
|
476
|
+
GET /inquiries/{inquiryId}/basic_info
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
Returns basic info without full quote result data.
|
|
480
|
+
|
|
481
|
+
**Error codes:**
|
|
482
|
+
| Code | Meaning |
|
|
483
|
+
|------|---------|
|
|
484
|
+
| 999 | 询价服务异常 |
|
|
485
|
+
|
|
486
|
+
---
|
|
487
|
+
|
|
488
|
+
### 2.13 Get Inquiry Detail (Simple/Middle-tier Cars)
|
|
489
|
+
|
|
490
|
+
For inquiries where `isSimpleDemand: true` (中端车):
|
|
491
|
+
|
|
492
|
+
```
|
|
493
|
+
GET /simple_inquiry/{inquiryId}/detail?platform=ANDROID
|
|
494
|
+
```
|
|
495
|
+
|
|
496
|
+
or the older route:
|
|
497
|
+
```
|
|
498
|
+
GET /inquiries/simple_inquiry/{inquiryId}?platform=ANDROID
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
**Check inquiry type first:**
|
|
502
|
+
```
|
|
503
|
+
GET /simple_inquiry/{inquiryId}/type
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
Returns whether the inquiry is a middle-tier ("中端车") type — used to decide which detail endpoint to call.
|
|
507
|
+
|
|
508
|
+
---
|
|
509
|
+
|
|
510
|
+
### 2.14 Get Quotation Progress
|
|
511
|
+
|
|
512
|
+
```
|
|
513
|
+
GET /inquiries/progress_info?inquiryId={id}&platform=ANDROID
|
|
514
|
+
```
|
|
515
|
+
|
|
516
|
+
For simple inquiries (中端车):
|
|
517
|
+
```
|
|
518
|
+
GET /simple_inquiry/progress_info?inquiryId={id}
|
|
519
|
+
```
|
|
520
|
+
|
|
521
|
+
Returns quote progress including per-supplier quotation status.
|
|
522
|
+
|
|
523
|
+
---
|
|
524
|
+
|
|
525
|
+
### 2.15 Get Store Quotation
|
|
526
|
+
|
|
527
|
+
```
|
|
528
|
+
GET /inquiries/store/quotation?inquiryId={id}&storeId={storeId}
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
Returns the quotation from a specific store for a given inquiry.
|
|
532
|
+
|
|
533
|
+
---
|
|
534
|
+
|
|
535
|
+
### 2.16 Get Quotation Scheme (导购单)
|
|
536
|
+
|
|
537
|
+
```
|
|
538
|
+
GET /inquiries/quotation_scheme?quotationId={id}
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
Returns purchase recommendation scheme list.
|
|
542
|
+
|
|
543
|
+
**Error codes:**
|
|
544
|
+
| Code | Meaning |
|
|
545
|
+
|------|---------|
|
|
546
|
+
| 651 | 无权限查看 |
|
|
547
|
+
| 784 | 导购单不存在 |
|
|
548
|
+
|
|
549
|
+
---
|
|
550
|
+
|
|
551
|
+
### 2.17 Get Parts List (Common Parts)
|
|
552
|
+
|
|
553
|
+
```
|
|
554
|
+
GET /inquiries/parts_new?vin={vin}&carBrandCode={code}
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
Returns commonly requested parts for a given VIN/brand. Useful for pre-populating inquiry UI.
|
|
558
|
+
|
|
559
|
+
Older variant (no VIN):
|
|
560
|
+
```
|
|
561
|
+
GET /inquiries/parts
|
|
562
|
+
```
|
|
563
|
+
|
|
564
|
+
---
|
|
565
|
+
|
|
566
|
+
### 2.18 Archive Endpoints (Cold Storage)
|
|
567
|
+
|
|
568
|
+
For older/archived inquiries:
|
|
569
|
+
|
|
570
|
+
```
|
|
571
|
+
GET /inquiry-archive/{inquiryId}/type — 判断是否冷库/是否轮胎
|
|
572
|
+
GET /inquiry-archive/{inquiryId}/head — 冷库询价单表头
|
|
573
|
+
GET /inquiry-archive/{inquiryId}/detail — 冷库询价单明细
|
|
574
|
+
GET /inquiry-archive/{inquiryId}/spd — 冷库 SPD 信息
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
---
|
|
578
|
+
|
|
579
|
+
### 2.19 Inquiry Cart
|
|
580
|
+
|
|
581
|
+
```
|
|
582
|
+
GET /inquiry-cart/count — 购物车配件数量
|
|
583
|
+
POST /inquiry-cart — 加入购物车
|
|
584
|
+
GET /inquiry-cart/coupons/{settleId} — 结算优惠券
|
|
585
|
+
GET /inquiry-cart/promotions/{cartId} — 购物车促销
|
|
586
|
+
GET /inquiry-cart/settle/{settleId} — 结算单详情
|
|
587
|
+
```
|
|
588
|
+
|
|
589
|
+
---
|
|
590
|
+
|
|
591
|
+
### 2.20 Tyre Inquiry Endpoints
|
|
592
|
+
|
|
593
|
+
```
|
|
594
|
+
GET /tyre_inquiry/brands — 轮胎品牌列表
|
|
595
|
+
GET /tyre_inquiry/condition — 当前VIN+规格询价状态
|
|
596
|
+
GET /tyre_inquiry/tyre_feature — 轮胎特性
|
|
597
|
+
GET /tyre_inquiry/header — 轮胎询价页表头
|
|
598
|
+
GET /tyre_inquiry/number — 询价次数
|
|
599
|
+
GET /tyre_inquiry/demand — 需求信息
|
|
600
|
+
GET /tyre_inquiry/tyre_switch — 功能开关
|
|
601
|
+
GET /tyre_inquiry/tyre_switch_config — 功能开关配置
|
|
602
|
+
GET /tyre_inquiry/inquiry/limit — 询价限制
|
|
603
|
+
GET /tyre_inquiry/{vin}/check — 轮胎询价VIN校验
|
|
604
|
+
GET /tyre_inquiry/tyre/specifications/{vin} — 轮胎规格
|
|
605
|
+
GET /tyre_inquiry/vehicle/models/{vin} — 车型列表
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
---
|
|
609
|
+
|
|
610
|
+
## 3. Complete CLI Flow
|
|
611
|
+
|
|
612
|
+
### Step 1: Lookup Vehicle Info
|
|
613
|
+
```
|
|
614
|
+
GET /inquiries/car_models?vin=<VIN>
|
|
615
|
+
```
|
|
616
|
+
Extract `carBrandId`, `carBrandName`, `carModelName`, `seriesId`, `locationId` etc.
|
|
617
|
+
|
|
618
|
+
### Step 2: Get Available Qualities
|
|
619
|
+
```
|
|
620
|
+
GET /inquiries/all_brand_qualities
|
|
621
|
+
GET /inquiries/brand_qualities (user defaults)
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
### Step 3: Create Inquiry
|
|
625
|
+
For authenticated users or accounts with `isSimpleInquiryAllowed: true`:
|
|
626
|
+
```
|
|
627
|
+
POST /inquiries/simple_inquiry
|
|
628
|
+
```
|
|
629
|
+
For all other accounts (including this test account):
|
|
630
|
+
```
|
|
631
|
+
POST /inquiries
|
|
632
|
+
```
|
|
633
|
+
Both return `{ inquiryId, isSimpleDemand }`.
|
|
634
|
+
|
|
635
|
+
### Step 4: Check Inquiry Status
|
|
636
|
+
```
|
|
637
|
+
POST /inquiries/list?page=1&size=20 (list all)
|
|
638
|
+
GET /inquiries/{id}/detailV2?platform=ANDROID (single)
|
|
639
|
+
```
|
|
640
|
+
If `isSimpleDemand: true`, use `GET /simple_inquiry/{id}/detail?platform=ANDROID` instead.
|
|
641
|
+
|
|
642
|
+
### Step 5: Get Quotes
|
|
643
|
+
```
|
|
644
|
+
GET /inquiries/progress_info?inquiryId={id}&platform=ANDROID
|
|
645
|
+
GET /inquiries/store/quotation?inquiryId={id}&storeId={storeId}
|
|
646
|
+
GET /inquiries/quotation_scheme?quotationId={id}
|
|
647
|
+
```
|
|
648
|
+
|
|
649
|
+
### Step 6: Add to Cart and Order
|
|
650
|
+
```
|
|
651
|
+
POST /inquiry-cart
|
|
652
|
+
POST /inquiry-cart/settle/{settleId} (finalize order)
|
|
653
|
+
```
|
|
654
|
+
|
|
655
|
+
---
|
|
656
|
+
|
|
657
|
+
## 4. carBrandId Discovery
|
|
658
|
+
|
|
659
|
+
`carBrandId` is not a static enum — it's dynamically resolved per garage/user. Two methods:
|
|
660
|
+
|
|
661
|
+
**Method A:** Use VIN decode (returns exact value for the inquiry)
|
|
662
|
+
```
|
|
663
|
+
GET /inquiries/car_models?vin=<VIN>
|
|
664
|
+
→ CarModel[].carBrandId
|
|
665
|
+
```
|
|
666
|
+
|
|
667
|
+
**Method B:** Get supported brands list
|
|
668
|
+
```
|
|
669
|
+
GET /inquiries/support_brands
|
|
670
|
+
→ supportBrand[].carBrandCode (this IS the carBrandId for most brands)
|
|
671
|
+
```
|
|
672
|
+
|
|
673
|
+
**Method C:** Filter conditions (also returns brand list)
|
|
674
|
+
```
|
|
675
|
+
GET /inquiries/filter_conditions
|
|
676
|
+
→ data.classifiedBrands.supportedBrands
|
|
677
|
+
```
|
|
678
|
+
|
|
679
|
+
Note: The `supportBrand` schema returns `carBrandCode` as the identifier. In `CreateInquiry`, this maps to `carBrandId`. Common values based on industry data: `TOYOTA` (丰田), `VW` (大众), `BMW` (宝马), `BENZ` (奔驰), `AUDI` (奥迪), `HONDA` (本田). Exact IDs must be looked up via `/support_brands` or `/car_models`.
|
|
680
|
+
|
|
681
|
+
---
|
|
682
|
+
|
|
683
|
+
## 5. Known Beta Environment Limitations
|
|
684
|
+
|
|
685
|
+
| Endpoint | Issue |
|
|
686
|
+
|----------|-------|
|
|
687
|
+
| `POST /inquiries/simple_inquiry` | Returns `999` ("系统繁忙") in beta; also blocked by `isSimpleInquiryAllowed: false` for this account |
|
|
688
|
+
| `POST /inquiries` | Should work in beta; is the correct path for this account |
|
|
689
|
+
| General | Beta environment may have intermittent `999` responses — retry once before treating as fatal |
|
|
690
|
+
| `isSimpleInquiryAllowed: false` | Account cannot use simple inquiry path; must use full `POST /inquiries` |
|
|
691
|
+
|
|
692
|
+
---
|
|
693
|
+
|
|
694
|
+
## 6. Error Code Reference
|
|
695
|
+
|
|
696
|
+
| Code | Meaning | Common context |
|
|
697
|
+
|------|---------|----------------|
|
|
698
|
+
| 0 | 成功 | All |
|
|
699
|
+
| 605 | 非法入参 (invalid params) | Missing required fields |
|
|
700
|
+
| 651 | 无权限查看 | Quotation scheme, detail |
|
|
701
|
+
| 652 | 账号在其它设备登录 | Auth |
|
|
702
|
+
| 654 | 账号未认证,需认证才可继续询价 | Simple inquiry creation |
|
|
703
|
+
| 701 | 不支持该VIN品牌 | car_models |
|
|
704
|
+
| 702 | 账号或密码错误 | Login |
|
|
705
|
+
| 711 | 生成询价单失败 | Inquiry creation |
|
|
706
|
+
| 775 | VIN码有误 | car_models |
|
|
707
|
+
| 784 | 导购单不存在 | quotation_scheme |
|
|
708
|
+
| 838 | 不支持7位宝马VIN码 | Inquiry creation |
|
|
709
|
+
| 999 | 系统繁忙 | All; especially beta env |
|
|
710
|
+
|
|
711
|
+
---
|
|
712
|
+
|
|
713
|
+
## 7. Current Account Summary
|
|
714
|
+
|
|
715
|
+
Based on the known account state (`user: 6a30adc4d644930001c0e687`):
|
|
716
|
+
|
|
717
|
+
- **Authentication status:** N (未认证)
|
|
718
|
+
- **Remaining inquiries:** 5 (can create up to 5 more without authenticating)
|
|
719
|
+
- **isSimpleInquiryAllowed:** false → must use `POST /inquiries` not `POST /inquiries/simple_inquiry`
|
|
720
|
+
- **registerCompleted:** true → basic registration done
|
|
721
|
+
|
|
722
|
+
**Recommended flow for this account:**
|
|
723
|
+
1. Call `GET /inquiries/remain_inquiry_number` to confirm quota
|
|
724
|
+
2. Call `GET /inquiries/car_models?vin=<VIN>` to get `carBrandId`
|
|
725
|
+
3. Call `POST /inquiries` with full body including `userNeeds` array
|
|
726
|
+
4. Poll `POST /inquiries/list?page=1&size=20` to track status
|
|
727
|
+
5. When status moves to `QUOTED`, call `GET /inquiries/{id}/detailV2?platform=ANDROID`
|
|
728
|
+
|
|
729
|
+
**Note:** To unlock unlimited inquiries and `isSimpleInquiryAllowed: true`, the account needs to complete company authentication (企业认证) through the platform.
|
|
730
|
+
|
|
731
|
+
---
|
|
732
|
+
|
|
733
|
+
## 8. Live Test Results
|
|
734
|
+
|
|
735
|
+
> Note: Bash and file read access to `~/.quote/config.json` were denied in this session, preventing live API testing. All results below are derived from swagger.json schema analysis and existing source code in `packages/cli/src/adapter/api.mjs`.
|
|
736
|
+
|
|
737
|
+
**What swagger.json confirms:**
|
|
738
|
+
- `POST /inquiries/simple_inquiry` requires `carBrandId`, `carBrandName`, `userName`, address geo fields, `simpleInquiryBatchItems`, and returns `654` for unauthenticated accounts
|
|
739
|
+
- `POST /inquiries` is the full-featured path, requires `vin`, `carBrandId`, `carBrandName`, `userName`, `contactNumber`, `isOpenInvoice`, `source`, `isSelectBrandFlag`, `isAnonymous`
|
|
740
|
+
- `POST /inquiries/list` uses page/size as query params, filter body is optional
|
|
741
|
+
- `GET /inquiries/remain_inquiry_number` requires no params and directly returns remaining count
|
|
742
|
+
- `GET /inquiries/all_brand_qualities` returns all 10 quality codes including `BRAND`, `ORIGINAL_BRAND`, `SECOND_HAND` etc.
|
|
743
|
+
|
|
744
|
+
**Current CLI implementation gap:**
|
|
745
|
+
The `api.mjs` `createInquiry()` method calls `POST /inquiries/simple_inquiry` but the account has `isSimpleInquiryAllowed: false`. The method should either:
|
|
746
|
+
1. Fall back to `POST /inquiries` when `isSimpleInquiryAllowed: false`
|
|
747
|
+
2. Always use `POST /inquiries` with the `userNeeds` array format
|
|
748
|
+
|
|
749
|
+
The `POST /inquiries` format differs from `simple_inquiry`: it uses `userNeeds` (structured array with `needsName`, `quantity`, etc.) instead of `simpleInquiryBatchItems` (free-form text/media items).
|