开发文档
999.md API 文档:2 个操作
999.md API 文档:广告 ID 与各搜索输入的作用,两页搜索结果如何衔接,以及返回的广告字段各表示什么。
另见: 999.md 摩尔多瓦分类广告 API 概览与价格 · 999.md API 指南:搜索、分页与广告详情
本页内容
广告详情:post-999-md-listing-detail
该操作读取一条广告并返回其主记录。body.listing_id 以两种形式之一指明广告:搜索行给出的数字 ID,或该广告在 999.md 上的规范地址,其路径是罗马尼亚语栏目后接该 ID。由于该字段是字符串,同一个输入可以承载任一形式。
在返回字段中,description 是搜索行所没有的广告长文本,attributes 是广告上列出的公开特征,seller 是描述发布者的信息块。source_price 保留广告显示的价格形式,与 price 金额及其 currency 并列;price_mode 说明该价格的标示方式,down_payment 是广告上的首付金额。
gtin 是该物品的零售条形码编号。url 是广告本身的地址,适合用作把用户引向原始页面的链接,images 则是附在广告上的照片。
本节涉及的字段(2)
post-999-md-listing-detail, body.listing_id
关键词搜索:post-999-md-search
该操作对摩尔多瓦分类广告进行全文搜索,并以罗马尼亚语呈现结果行。body.query 承载搜索文本;超过 40 个字符的查询会被拒绝,而不是被截短。最简单的请求只含查询文本,它读取前 10 条匹配,因为页码和每页大小都会取默认值。
body.page 与 body.limit 成对使用:limit 设定每页大小,page 选择该大小的第一段或第二段,所以只有沿用第 1 页的 limit 发送时,第 2 页才有意义。在回复中,count 报告本页有多少行,结果较少时会小于 limit;source_total 是该查询的匹配总数;has_more 显示结果是否在当前页之后继续。搜索在第 2 页之后停止,因此总数大于 limit 两倍的查询只能取到其中一部分匹配。
本节涉及的字段(4)
post-999-md-search, body.query, body.page, body.limit
从搜索行到 999.md API 广告记录
搜索行与广告记录共享识别字段和价格字段,所以两者的值无需换算即可比较。从 post-999-md-search 任一行取得的 listing_id,可以原样交给 post-999-md-listing-detail,返回的记录在该行已有内容之外,再加上广告正文、属性和卖家。
同时保存两者的代码应以 listing_id 为键,因为同一条广告可能在一次运行中位于第 1 页,在之后的另一次运行中位于第 2 页。搜索行已带有 gtin 和价格字段,所以把二手物品与目录商品对应,或按价格筛选,都可以在花费任何一次详情查询之前完成。
本节涉及的字段(3)
post-999-md-search, post-999-md-listing-detail, body.listing_id
{
"body": {
"query": "apartament",
"page": 2,
"limit": 20
}
}
{
"body": {
"listing_id": "https://999.md/ro/88886722"
}
}
操作
公共网关操作统一使用 POST /api/v1/{project}/{action}。
使用 JSON 对象,按文档将参数放入 path、query、headers 和 body,省略未使用的位置。input.headers 是供操作使用的 JSON 数据,不是浏览器请求头。请勿在此填写凭证。按文档保留 body 的数组、标量或 null;省略与 null 含义不同。
广告详情
POST /api/v1/md-999/post-999-md-listing-detail
凭数字 ID 或规范地址查询,返回一条 999.md 广告的详细记录。
输入字段
| 字段 | 类型 | 是否必填 | 允许的值 | 范围限制 |
|---|---|---|---|---|
body.listing_id | 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/md-999/post-999-md-listing-detail' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"listing_id":"88886722"}}'响应字段
listing_idurltitlepricecurrencysource_priceprice_modedown_paymentdescriptionimagesattributessellergtin
关键词搜索
POST /api/v1/md-999/post-999-md-search
用自由文本搜索 999.md 分类广告,返回一页精简的广告行。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.query | string | 必填 | — | — | — |
body.limit | integer | 可选 | 10 | — | 1–20 |
body.page | integer | 可选 | 1 | — | 1–2 |
请求示例
# 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/md-999/post-999-md-search' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"limit":3,"query":"iphone"}}'响应字段
querypagelimitcountresults[]listing_idurltitlepricecurrencysource_priceprice_modedown_paymentimagesgtin
source_totalhas_more
调用方式
- 使用
POST /api/v1/md-999/<action>,并携带x-api-key、Content-Type: application/json和必需的Idempotency-Key。 - 调用成功时返回
ok: true:data是操作的结果,meta.requestId标识已记录的请求,meta.chargedCreditUnits是实际扣费金额。否则ok为false,error.code说明原因;请读取ok和error.code,不要只依赖 HTTP 状态码。每个网关响应都带有供支持使用的请求 ID:meta.requestId;没有meta的响应(如受理前被拒绝)则为顶层requestId。 - 只有调用成功才按标价扣费。失败不扣费;结果无法确认时,最多 900 秒后释放,不扣费。
- 请求完成后,以同一个 Idempotency-Key 重复发送相同请求,24 小时内返回已保存的响应,不会再次扣费。
网关调用参考: