开发文档
Polovni Automobili API 输入、字段与错误参考
Polovni Automobili API 参考:五个操作的全部输入及其限制、各操作返回的字段、请求示例、错误码与计费规则。
另见: Polovni Automobili 二手车信息概览与价格 · Polovni Automobili API 使用指南
本页内容
Polovni Automobili API 端点与请求头
每个操作都有自己的端点,所有调用都使用 POST,路径最后一段是包含 polovniautomobili- 前缀的完整操作 ID。每次调用时请:
- 在
x-api-key中携带密钥 - 设置请求头
Content-Type: application/json - 提供由 8 至 128 个字母、数字、冒号、下划线或连字符组成的
Idempotency-Key
输入放在 body 下的同一个 JSON 对象中。brands 与 filter-options 不声明任何字段,输入写作 {} 或 {"body":{}} 均可。整个请求体最大 64 KiB。
本节涉及的字段(6)
polovniautomobili-search, polovniautomobili-listing, polovniautomobili-brands, polovniautomobili-models, polovniautomobili-filter-options, Idempotency-Key
search:品牌、车型与区间筛选
search 的所有字段都是可选的。brand 取自一个包含 99 个值的封闭列表,空格和变音符号必须相符,大小写不限:Mercedes Benz、Škoda、Lynk & Co 和 volkswagen 都会被接受。model 是车型名称数组,写法与该市场一致,例如 Golf 或 A4。
车型隶属于品牌,因此 model 要与 brand 一起发送;传入多个名称时,结果行命中其中任意一个即可。区间筛选都是带固定范围的整数:
price_min与price_max为 0 至 9,999,999,单位是广告自身的币种year_min与year_max为 1900 至 2100mileage_min与mileage_max为 0 至 9,999,999 公里power_kw_min与power_kw_max为 0 至 2,000 kWengine_cc_min与engine_cc_max为 0 至 20,000 cc
功率只能按千瓦筛选,所以马力上下限要先换算再发送;结果行会同时给出 power_kw 和 power_hp。超出范围的值会以 REQUEST_NOT_FULFILLED 或 REQUEST_REJECTED(502)拒绝,不会扣费。
本节涉及的字段(13)
polovniautomobili-search, body.brand, body.model, body.price_min, body.price_max, body.year_min, body.year_max, body.mileage_min, body.mileage_max, body.power_kw_min, body.power_kw_max, body.engine_cc_min, body.engine_cc_max
search:分类筛选与开关
多个筛选条件接受数组,数组元素来自固定列表。其中:
fuel中列出的多种燃料按“或”的关系匹配gearbox把手动挡按挡位数分开,manual4Gears、manual5Gears、manual6Gears与automatic并列colour使用包含 21 种外观颜色的词表plates区分塞尔维亚本地车牌、待过户到买家名下的车辆和外国车牌damaged区分无损伤车辆、有损伤但仍可行驶的车辆以及有损伤且无法行驶的车辆
单值筛选均为字符串:
emission_class取euro1至euro6中的一个欧排放等级doors用"3"表示两门或三门,用"5"表示四门或五门seats取"2"至"9"之间的一个确切座位数wheel_side、flywheel(是否为双质量飞轮)和attest(车辆是否持有塞尔维亚改装认证)各取一个值country指广告的发布国家,RS代表塞尔维亚;country_of_origin指车辆的进口来源国
only_with_price: true 排除没有报价的广告,registered_to_seller: true 只保留登记在卖家名下的车辆,listing_age 取 used、new 或默认的 all。
本节涉及的字段(14)
polovniautomobili-search, body.fuel, body.gearbox, body.colour, body.plates, body.damaged, body.emission_class, body.doors, body.seats, body.country, body.country_of_origin, body.only_with_price, body.registered_to_seller, body.listing_age
search:分页与结果页
page 是 1 至 750 的整数,默认为 1;page_size 取 25、50、100 或 200,默认为 25。无论每页行数是多少,页码都止于 750,因此每页 25 行时,一个结果集最多只能读到 18,750 条广告,每页 200 行时可读到 150,000 条;搜索命中的广告较多时请选 200。
第 751 页及之后的页码会以 REQUEST_NOT_FULFILLED 或 REQUEST_REJECTED(502)拒绝,不收费。结果先给出以下字段:
- 计数与分页:
total_results、page与page_size、pages、has_more、行数count以及duplicates_dropped - 筛选条件与 URL:
filters_applied和search_url
然后是 cars 中符合条件的结果行和 top_ads 中的付费推广。pages 是该市场自己给出的页数,而 reachable_pages 与 reachable_results 表示分页实际能到达的范围。第一个请求示例查询 2015 年及以后出厂的柴油 Golf,每页 200 行;只要 has_more 为 true,就用 page: 2 继续发送。
本节涉及的字段(3)
polovniautomobili-search, body.page, body.page_size
listing:按 ad_id 读取一条广告
ad_id 为必填字符串:请从搜索结果行的 ad_id 原样复制,例如 "9182736405";本站对 ad_id 接受任意字符串。slug 为可选字段。它的内容不影响返回哪条广告;只有希望它出现在规范 URL 中时才需要传入。
已删除或已失效的广告会返回失败,即 REQUEST_NOT_FULFILLED 或 REQUEST_REJECTED(502),而不是空的成功响应,并且不扣费。成功响应为 {car:{…}}:
- 身份字段:
ad_id、url、title、brand、model、variant、year - 价格字段:
price、price_currency、price_on_request、price_fixed - 技术字段:搜索结果行中的技术字段,外加
drive、颜色与内饰材质 - 登记信息:
registration_valid_until、registration_cost_min、registration_cost_max、plates、country、imported - 所有权与交易条件:
owner_legal_status、registered_to_seller、selling_method、trade_in、reserved、status - 描述与数组:描述以及
condition、equipment、safety、images数组 - 日期:
published_at与renewed_at - 其他字段:
financing、seller和breadcrumbs
本节涉及的字段(3)
polovniautomobili-listing, body.ad_id, body.slug
brands:品牌标签列表
polovniautomobili-brands 不需要任何字段;发送 {} 或 {"body":{}} 即可。它返回 count、total_ads 和 brands,后者是由 brand、label、slug 组成的条目数组。label 就是 search 与 models 的 brand 字段所接受的值,除大小写外须按原样书写,例如带空格的 Mercedes Benz。
slug 是该市场 URL 中使用的品牌写法,不能作为筛选值。品牌字段共接受 99 个标签,其中之一是兜底的 other;列表以外的标签,或手工输入的 mercedes-benz 这类写法,都会以 REQUEST_NOT_FULFILLED 或 REQUEST_REJECTED(502)拒绝,不收费。每次 brands 调用按 300 积分单位计费,因此做筛选表单时取一次列表即可,不必在每次搜索前都调用。
本节涉及的字段(2)
polovniautomobili-brands, body.brand
models:某一品牌的车型名称
brand 为必填,接受与 search 相同的 99 个精确标签。sample_pages 可选,取 1 至 10 的整数;省略时读取 3 页。
每个采样页包含该品牌的 200 条广告,所以默认最多读取 600 条,最大值时最多读取 2,000 条。结果包含:
brand和brand_ads(该品牌的全部广告数)ads_sampled和sample_pagessample_coverage_pct(已读取广告占该品牌全部广告的比例)count和models,后者是{model, ads_seen}数组
只有当至少一条采样广告带有某个车型时,这个车型才会出现;所以对于广告很多的品牌,应提高 sample_pages,直到 sample_coverage_pct 满足你的需要。model 字符串的写法正是 search 的 model 筛选所接受的写法。不论 sample_pages 取多少,每次调用的价格都是 450 积分单位。
本节涉及的字段(3)
polovniautomobili-models, body.brand, body.sample_pages
filter-options:搜索词表
polovniautomobili-filter-options 不需要任何字段。它返回 count、sorts、listing_age 和 groups。每个分组:
- 在
param中写明它对应的搜索参数 - 在
source_field中写明该市场自己的字段名 - 用
filterable说明它是否真正起筛选作用 - 列出
count和values,每个取值都是带塞尔维亚语标签的{value, label}对
分组涵盖燃料、变速箱、车身、颜色、内饰、驱动方式、排放等级、损伤、车牌、车况与历史、97 项配置清单、18 项安全配置清单、地区和国家。只有当某个分组的 param 同时也是本站 search 契约中的字段时,才使用它的取值:配置、安全配置和地区分组在这里没有对应的搜索字段。标为 filterable: false 的分组虽然公开,但并不会缩小结果范围。
本节涉及的字段(1)
polovniautomobili-filter-options
成功信封与每次调用价格
成功响应为 {ok:true, data, meta:{requestId, chargedCreditUnits, simulated, sourceAttribution}}。data 是操作结果,其结构见上文各操作的说明,并且可以为 null。
data:null 的成功响应同样按该操作已批准的每次调用价格计费:search、listing、brands 与 filter-options 为 300 积分单位,models 为 450 积分单位,100 单位等于 1 积分。meta 中的 chargedCreditUnits 表示这次调用的费用,requestId 用于在你的记录和支持咨询中标识这次请求。
本节涉及的字段(3)
ok, data, priceCreditUnits
失败码与不确定结果
已受理但失败的请求返回 {ok:false, error:{code,message}, meta:{requestId, chargedCreditUnits:"0", status}},首次响应中的 status 为 "failure" 或 "uncertain"。REQUEST_NOT_FULFILLED(502)表示该操作报告未成功,REQUEST_REJECTED(502)表示该操作拒绝了此请求;SERVICE_UNAVAILABLE 和 SERVICE_BUSY(503)表示服务端的状况,与你的密钥或钱包无关。这些失败不扣费。
OPERATION_FAILED(502)表示操作未产生结果,同样不扣费。OPERATION_TIMEOUT(504)、OUTCOME_UNKNOWN(504 或 502)、RESULT_INVALID(502)和 RESULT_TOO_LARGE(502)属于不确定结果:价格先被预留,随后释放,之后也不会扣费。
不要换新的 Idempotency-Key 重试这些请求。使用同一 key 原样重发请求时,会返回已记录的状态,而不会再次执行:未解决时为 REQUEST_PENDING(409,meta.status 为 "dispatching" 或 "uncertain"),预留释放后为 OUTCOME_UNKNOWN_RELEASED(504,meta.status 为 "released",chargedCreditUnits 为 "0")。
本节涉及的字段(4)
error, ok, data, Idempotency-Key
受理前错误与同 key 回放
请求受理前返回的错误结构为 {ok:false,error:{code,message},requestId},requestId 位于顶层,没有 meta。例如 AUTH_FAILED(401)、INSUFFICIENT_CREDITS(402)、IDEMPOTENCY_CONFLICT(409)、请求体不是有效 JSON 时的 INVALID_REQUEST(400),以及请求体超过 64 KiB 时的 PAYLOAD_TOO_LARGE(413)。除 IDEMPOTENCY_CONFLICT(表示该 key 已属于另一个请求,需要换新 key)外,这些拒绝不会记录任何内容,修正后的请求可以继续使用同一个 Idempotency-Key;RATE_LIMITED 和 CONCURRENCY_LIMIT(429)会带有以秒为单位的 Retry-After,等待之后用同一个 key 重发同一请求。
被操作拒绝的取值处理方式不同:请求会先被受理,然后以 REQUEST_NOT_FULFILLED 或 REQUEST_REJECTED(502)失败,meta.chargedCreditUnits 为 "0",meta.status 为 "failure"。不扣费,但该操作必须已启用,且你的可用积分必须足以支付其价格;修正后的请求要使用新的 Idempotency-Key 发送。已保存的最终响应在 24 小时内按原状态码和响应体回放;超过 24 小时后,成功过的请求返回 RESULT_EXPIRED(410,meta.status 为 "succeeded"),这并不是退款,失败过的请求则返回其记录的错误码和 HTTP 状态码。
本节涉及的字段(3)
ok, error, Idempotency-Key
{
"body": {
"brand": "Volkswagen",
"model": [
"Golf"
],
"fuel": [
"diesel"
],
"year_min": 2015,
"page": 1,
"page_size": 200
}
}{
"body": {
"ad_id": "9182736405"
}
}{
"body": {}
}{
"body": {
"brand": "Audi",
"sample_pages": 5
}
}{}操作
公共网关操作统一使用 POST /api/v1/{project}/{action}。
使用 JSON 对象,按文档将参数放入 path、query、headers 和 body,省略未使用的位置。input.headers 是供操作使用的 JSON 数据,不是浏览器请求头。请勿在此填写凭证。按文档保留 body 的数组、标量或 null;省略与 null 含义不同。
查询汽车品牌
POST /api/v1/polovniautomobili/polovniautomobili-brands
返回各品牌及其 URL slug,以及品牌筛选所接受的精确标签;无需输入。
输入字段
此操作没有输入字段,发送下方所示的 JSON 请求体即可。
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/polovniautomobili/polovniautomobili-brands' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{}}'获取筛选词表
POST /api/v1/polovniautomobili/polovniautomobili-filter-options
返回各筛选分组的取值、塞尔维亚语标签及其对应的搜索参数;无需输入。
输入字段
此操作没有输入字段,发送下方所示的 JSON 请求体即可。
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/polovniautomobili/polovniautomobili-filter-options' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{}}'读取单条汽车广告
POST /api/v1/polovniautomobili/polovniautomobili-listing
按搜索结果行的 ad_id 返回一条完整广告。
输入字段
| 字段 | 类型 | 是否必填 | 允许的值 | 范围限制 |
|---|---|---|---|---|
body.ad_id | string | 必填 | — | — |
body.slug | string | 可选 | — | — |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/polovniautomobili/polovniautomobili-listing' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"ad_id":"example","slug":"example"}}'查询品牌下的车型
POST /api/v1/polovniautomobili/polovniautomobili-models
读取某一品牌 1–10 页、每页 200 条广告(默认 3 页),返回每个车型名称及其出现的广告数。
输入字段
| 字段 | 类型 | 是否必填 | 允许的值 | 范围限制 |
|---|---|---|---|---|
body.brand | string | 必填 | 99 个值"Alfa Romeo""Alpina""Alpine""Aro""Aston Martin""Audi""Avantier""BAIC""BAW""Bentley""BMW""BYD""Cadillac""Changan""Chery""Chevrolet""Chrysler""Citroen""Cupra""Dacia""Daewoo""Daihatsu""Dodge""Dongfeng""DR""DS""Ferrari""Fiat""Ford""Foton""GAZ""Geely""Genesis""GMC""Honda""Hummer""Hyundai""Ineos""Infiniti""Isuzu""JAC Motors""Jaguar""Jeep""Jetour""JMEV""KGM""Kia""Lada""Lamborghini""Lancia""Land Rover""Leapmotor""Lexus""Lincoln""Lynk & Co""Mahindra""Maserati""Maxus""Maybach""Mazda""McLaren""Mercedes Benz""MG""MINI""Mitsubishi""Moskvitch""Nissan""NSU""Oldsmobile""Opel""Peugeot""Polski Fiat""Pontiac""Porsche""Ram""Renault""Rolls Royce""Rover""Saab""Seat""Seres""Smart""SsangYong""Subaru""Suzuki""SWM""Škoda""Tata""Tesla""Toyota""Trabant""UAZ""Volkswagen""Volvo""Wartburg""Xiaomi""Yudo Auto""Zastava""other" | — |
body.sample_pages | integer | 可选 | — | 1–10 |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/polovniautomobili/polovniautomobili-models' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"brand":"Alfa Romeo","sample_pages":1}}'筛选汽车广告
POST /api/v1/polovniautomobili/polovniautomobili-search
按品牌、车型、价格、年份、里程、功率、燃料、车身等条件筛选广告,每页 25、50、100 或 200 行,最多到第 750 页。
输入字段
| 字段 | 类型 | 是否必填 | 允许的值 | 范围限制 |
|---|---|---|---|---|
body.air_conditioning | string[] | 可选 | "none""manual""automatic" | — |
body.attest | string | 可选 | "attested""notAttested" | — |
body.body_type | string[] | 可选 | "sedan""hatchback""caravan""coupe""cabrioletOrRoadster""minivan""suv""pickup" | — |
body.brand | string | 可选 | 99 个值"Alfa Romeo""Alpina""Alpine""Aro""Aston Martin""Audi""Avantier""BAIC""BAW""Bentley""BMW""BYD""Cadillac""Changan""Chery""Chevrolet""Chrysler""Citroen""Cupra""Dacia""Daewoo""Daihatsu""Dodge""Dongfeng""DR""DS""Ferrari""Fiat""Ford""Foton""GAZ""Geely""Genesis""GMC""Honda""Hummer""Hyundai""Ineos""Infiniti""Isuzu""JAC Motors""Jaguar""Jeep""Jetour""JMEV""KGM""Kia""Lada""Lamborghini""Lancia""Land Rover""Leapmotor""Lexus""Lincoln""Lynk & Co""Mahindra""Maserati""Maxus""Maybach""Mazda""McLaren""Mercedes Benz""MG""MINI""Mitsubishi""Moskvitch""Nissan""NSU""Oldsmobile""Opel""Peugeot""Polski Fiat""Pontiac""Porsche""Ram""Renault""Rolls Royce""Rover""Saab""Seat""Seres""Smart""SsangYong""Subaru""Suzuki""SWM""Škoda""Tata""Tesla""Toyota""Trabant""UAZ""Volkswagen""Volvo""Wartburg""Xiaomi""Yudo Auto""Zastava""other" | — |
body.colour | string[] | 可选 | 21 个值"white""pearlWhite""beige""bordeaux""brown""black""red""chameleon""cream""purple""orange""blue""grey""brown2""silver""turquoise""navyBlue""green""golden""yellow""pink" | — |
body.country | string | 可选 | 35 个值"RS""ME""BA""BE""FR""NL""IT""DE""RU""CH""GB""AT""BG""CZ""DK""HR""IE""LT""LU""HU""MK""PT""RO""SK""SI""ES""SE""PL""NO""JP""CN""TR""KR""US""XX" | — |
body.country_of_origin | string | 可选 | 33 个值"ME""BA""BE""FR""NL""IT""DE""RU""CH""GB""AT""BG""CZ""DK""HR""IE""LT""LU""HU""MK""PT""RO""SK""SI""ES""SE""PL""NO""JP""CN""TR""KR""US" | — |
body.damaged | string[] | 可选 | "notDamaged""damagedInDrivingCondition""damagedNotInDrivingCondition" | — |
body.doors | string | 可选 | "3""5" | — |
body.drive | string[] | 可选 | "front""rear""4x4""4x4Reducer" | — |
body.emission_class | string | 可选 | "euro1""euro2""euro3""euro4""euro5""euro6" | — |
body.engine_cc_max | integer | 可选 | — | 0–20000 |
body.engine_cc_min | integer | 可选 | — | 0–20000 |
body.flywheel | string | 可选 | "floatingFlywheel""noFloatingFlywheel" | — |
body.fuel | string[] | 可选 | "gasoline""diesel""gasolineLpg""gasolineCng""hybridGasoline""hybridDiesel""plugInHybrid""hybrid""electric" | — |
body.gearbox | string[] | 可选 | "manual4Gears""manual5Gears""manual6Gears""automatic" | — |
body.interior_colour | string[] | 可选 | "black""beige""brown""grey""other" | — |
body.interior_material | string[] | 可选 | "cloth""leather""combinedLeather""velor""other" | — |
body.listing_age | string | 可选 | "all""used""new" | — |
body.mileage_max | integer | 可选 | — | 0–9999999 |
body.mileage_min | integer | 可选 | — | 0–9999999 |
body.model | string[] | 可选 | — | — |
body.only_with_price | boolean | 可选 | — | — |
body.page | integer | 可选 | — | 1–750 |
body.page_size | number | 可选 | 2550100200 | — |
body.plates | string[] | 可选 | "domesticPlates""onBuyersName""foreignPlates" | — |
body.power_kw_max | integer | 可选 | — | 0–2000 |
body.power_kw_min | integer | 可选 | — | 0–2000 |
body.price_max | integer | 可选 | — | 0–9999999 |
body.price_min | integer | 可选 | — | 0–9999999 |
body.registered_to_seller | boolean | 可选 | — | — |
body.seats | string | 可选 | "2""3""4""5""6""7""8""9" | — |
body.trade_in | string[] | 可选 | "noExchange""tradeForCheaper""samePrice""tradeForMoreExpensive""noPreference" | — |
body.wheel_side | string | 可选 | "left""right" | — |
body.year_max | integer | 可选 | — | 1900–2100 |
body.year_min | integer | 可选 | — | 1900–2100 |
请求示例
# Server-side only. Set KAKIAPI_API_KEY in your secret manager.
# Every gateway operation is called with POST.
# Only operations shown as enabled on the API page can be called.
# Generate once per intent; retain the same value on status checks.
REQUEST_ID="$(uuidgen)"
curl --request POST 'https://kakiapi.com/api/v1/polovniautomobili/polovniautomobili-search' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"air_conditioning":["none"],"attest":"attested","body_type":["sedan"],"brand":"Alfa Romeo","colour":["white"],"country":"RS","country_of_origin":"ME","damaged":["notDamaged"],"doors":"3","drive":["front"],"emission_class":"euro1","engine_cc_max":0,"engine_cc_min":0,"flywheel":"floatingFlywheel","fuel":["gasoline"],"gearbox":["manual4Gears"],"interior_colour":["black"],"interior_material":["cloth"],"listing_age":"all","mileage_max":0,"mileage_min":0,"model":["example"],"only_with_price":false,"page":1,"page_size":25,"plates":["domesticPlates"],"power_kw_max":0,"power_kw_min":0,"price_max":0,"price_min":0,"registered_to_seller":false,"seats":"2","trade_in":["noExchange"],"wheel_side":"left","year_max":1900,"year_min":1900}}'