开发文档
ALDI US 接口参考
ALDI US 接口参考:七个操作各自接受的输入字段、文档中的默认值与取值范围,以及各自回复中的内容。
另见: ALDI US 接口:价格、库存与门店数据概览与价格 · ALDI US 接口指南:搜索与分页
本页内容
aldi-us-categories:部门与分类目录树
aldi-us-categories 的回复不会出现在本页其他任何地方,因此这里列出它的字段。departments 是一份列表,列出 aldi.us 每个部门的 slug、name 与 url。collections 是另一份独立的顶层列表,形状同样是 slug、name、url,但每一项还带有嵌套的 children,形状相同,位于再深一层;这份列表既包含与部门关联的分类,也包含 ALDI 自有品牌与饮食分类,因此它并不只是把每个部门的分类合并在一起。
把某个部门的 slug 作为 body.department 发送,会把回复收窄到该部门自身的 collections,而不是完整的顶层列表。把某个分类的 slug 作为 body.slug 发送,则会返回该分类的 children,比单独使用 body.department 再深入一层。body.service_type 在这个操作与其他计价操作上,可在 delivery、in_store 与 pickup 之间选择;在所测量的 42 个商品中,有 31 个的店内价格低于配送价格。
本节涉及的字段(4)
aldi-us-categories, body.department, body.slug, body.service_type
aldi-us-category:分页效果与表格之外的行字段
由于 aldi.us 自身的商品顺序可能在两次调用之间变化,用 body.page 翻阅 aldi-us-category 可能会返回已在前一页出现过的商品,或漏掉某个商品,即便每页大小保持不变。改为发送 body.cursor——连同同样的 body.slug、门店字段与 body.per_page,且不带 body.page——可以避免这个问题:自上次调用之后位置发生变化的行会从新的一页中剔除,而不是重复出现,这一页会用当前列表中剩余的内容补足,而不是数量不够。
请求超出当前结果末尾的页码会被拒绝,而不会以空结果作答,因此用 body.page 翻页的调用方需要在这种情况发生时停止,而不是一直翻到上限。在每个商品行内,promotions 列出该商品当前所属的促销列表,dietary 列出其饮食标签;两者都不再进一步拆分出下级字段。
本节涉及的字段(4)
aldi-us-category, body.page, body.per_page, body.cursor
aldi-us-offers:解析 body.type,以及这份回复缺少的字段
aldi-us-offers 上的 body.type 决定调用读取四份促销列表中的哪一份,而不是把四份合并成一份回复。
weekly_ad:当前的每周特惠aldi_finds:本周的 ALDI Findsupcoming_aldi_finds:下周三的 ALDI Findsprice_drops:ALDI 当前的降价商品
这四个取值各自返回自己的 collection 与 products,因此切换取值会改变同一批回复字段所描述的列表。body.date 只影响 aldi_finds,用来指定某份 ALDI Finds 清单开始的那个周三,格式为 YYYY-MM-DD;在其他三个取值上,它会被接受,但不会改变读取的是哪份列表。这个操作的回复带有 page 与 has_more,但不带有 aldi-us-category 和 aldi-us-search 所带的 per_page 或 last_page 字段。
翻页的调用方只能依靠 has_more 来判断是否还有下一页。在每个商品行内,promotions 与 dietary 携带的是与 aldi-us-category 中描述相同的两份列表,这里同样不再进一步拆分。
本节涉及的字段(3)
aldi-us-offers, body.type, body.date
aldi-us-product-detail:完整的回复字段
本页其他地方都不会展示 aldi-us-product-detail 自己的回复内容,所以这里单独列出;其中 description、details、配料、使用方法、营养成分文字、警示语、other_sections、breadcrumb、rating、rating_count 与 retailer_item 等字段都不会出现在 aldi-us-category、aldi-us-offers 或 aldi-us-search 的列表行中。
| 字段 | 内容 |
|---|---|
product | 名称、品牌、规格、分类、url、描述、详情、配料、使用方法、营养成分文字与警示语 |
other_sections | 以上字段之外的进一步信息小节 |
images | 商品图片 |
breadcrumb | 指向该商品的分类路径 |
rating | 商品的平均评分 |
rating_count | 该平均分所基于的评分数量 |
retailer_item | 所选门店给出的价格、原价、单位价格、库存与营养信息 |
除此之外,这份回复还带有 price、store、service_type、postal_code、store_defaulted 与 currency:
store与service_type同样出现在aldi-us-category、aldi-us-offers、aldi-us-promotions与aldi-us-search的回复中postal_code与store_defaulted同样出现在这四个操作中currency也同样出现在其中,而price出现在aldi-us-category、aldi-us-offers与aldi-us-search中,但不出现在aldi-us-promotions中
当所选门店完全没有上架该商品时,retailer_item 会返回 null,并附带 retailer_item_note,而不是给出一组空的数字。body.product_id 同样接受 id 与 aldi.us 商品页面 URL 作为同一字段的替代取值。
本节涉及的字段(2)
aldi-us-product-detail, body.product_id
aldi-us-promotions:在调用 offers 之前先读取 product_count
这份回复 promotions 列表中的每一项,描述的都是 aldi-us-offers 可以通过 body.type 读取的同一四份列表之一,因此两个操作共用同一套说法,而不是在每处用不同名称。一项的 product_count 用来区分一份当前确实有商品的列表与一份仅是已安排但尚无商品的列表;只需要判断是否值得再花一次调用去读取其中一份列表的调用方,可以只检查 product_count 而不读取列表本身,available 则直接给出同样的是否判断。由于每一项描述的都是 body.postal_code、body.store_id 与 body.service_type 所解析到的同一家门店,这里采用的门店解析方式与 aldi-us-offers 和 aldi-us-category 相同,因此在一次调用中已经解析好的门店,不需要在另一次调用中重新选定。
本节涉及的字段(1)
aldi-us-promotions
aldi-us-search:查询处理,以及分类列表没有的行
aldi-us-search 上的 body.query 同样接受 q 与 keyword 作为替代名称,回复会把它以 query 的形式原样返回,方便只读取回复本身的调用方也能分辨是哪个词产生了这份结果。aldi.us 自身的搜索会用不相关的商品填充无匹配的查询,而不是直接返回空结果,每一行都带有 matches_query,方便调用方判断哪些行确实匹配。body.include_unmatched 保持默认值 false 时,会丢弃没有任何一行匹配的整页结果,并计入 unmatched_dropped;设为 true 时,则会在回复中保留这一整页连同其中不相关的行。
unmatched_dropped 与 last_page 出现在这份回复中,却不出现在 aldi-us-offers 的回复中,因此针对其中一个编写的代码不能假定另一个也带有同样的字段。在每一行内,promotions 与 dietary 携带的是与 aldi-us-category 中已经描述过的同样两份列表。
本节涉及的字段(3)
aldi-us-search, body.query, body.include_unmatched
aldi-us-stores:service_types 的取值与必需字段
aldi-us-stores 的 service_types 列表中的每一项,取值与 body.service_type 在别处使用的三个取值相同:delivery、in_store 或 pickup,因此一家同时提供三种服务的门店,这份列表中会同时带有这三个值。services_text 与 unavailable_text 在这份纯取值列表之外,携带门店自己关于支持与不支持哪些服务的文字说明。
body.postal_code 在这里是必需字段,这与计价类操作不同——那些操作中该字段是可选的,并有一个默认门店;这个操作没有可以回退的默认邮编。它同样接受 zip 与 zip_code 作为同一字段的替代名称,与计价类操作的 body.postal_code 所接受的别名相同。
本节涉及的字段(3)
aldi-us-stores, body.postal_code, body.limit
ALDI US 接口中原样接受的替代字段名
多个输入字段都接受不止一个名称来发送同一个取值;发送其中任意一个,效果都与发送下表所列的那个字段相同。
| 字段 | 同样接受的替代名称 |
|---|---|
body.postal_code,七个操作均适用 | zip、zip_code |
body.slug,aldi-us-categories 上 | collection |
body.slug,aldi-us-category 上 | collection、url |
body.product_id,aldi-us-product-detail 上 | id、url |
body.query,aldi-us-search 上 | q、keyword |
body.cursor,aldi-us-category、aldi-us-offers、aldi-us-search 上 | next_cursor |
在 aldi-us-category 上,url 读取的是完整的 aldi.us 分类页面地址,而不是单纯的 slug;在 aldi-us-product-detail 上,url 读取的是完整的商品页面地址,而不是单纯的 id。这些替代名称都不会改变操作对该取值的处理方式,只会改变取值发送时使用的键名。在可选使用 body.postal_code 的六个操作上,完全不发送该字段会按默认门店(邮编 60174)计价,回复中的 store_defaulted 会显示为 true。
本节涉及的字段(12)
aldi-us-categories, aldi-us-category, aldi-us-offers, aldi-us-product-detail, aldi-us-promotions, aldi-us-search, aldi-us-stores, body.postal_code, body.slug, body.product_id, body.query, body.cursor
{
"body": {
"query": "milk",
"postal_code": "60174"
}
}操作
公共网关操作统一使用 POST /api/v1/{project}/{action}。
使用 JSON 对象,按文档将参数放入 path、query、headers 和 body,省略未使用的位置。input.headers 是供操作使用的 JSON 数据,不是浏览器请求头。请勿在此填写凭证。按文档保留 body 的数组、标量或 null;省略与 null 含义不同。
分类目录树
POST /api/v1/aldi-us/aldi-us-categories
返回 aldi.us 的部门与分类目录,包括某个部门自身的分类,或某个分类目录下的子分类。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.department | string | 可选 | — | — | — |
body.postal_code | string | 可选 | — | — | — |
body.service_type | string | 可选 | "delivery" | "delivery""in_store""pickup" | — |
body.slug | string | 可选 | — | — | — |
body.store_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/aldi-us/aldi-us-categories' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"department":"dairy-and-eggs"}}'分类商品列表
POST /api/v1/aldi-us/aldi-us-category
列出 aldi.us 某个分类目录下的所有商品,按所选门店计价,支持分页。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.slug | string | 必填 | — | — | — |
body.cursor | string | 可选 | — | — | — |
body.page | integer | 可选 | 1 | — | 1–200 |
body.per_page | integer | 可选 | 20 | — | 1–40 |
body.postal_code | string | 可选 | — | — | — |
body.service_type | string | 可选 | "delivery" | "delivery""in_store""pickup" | — |
body.store_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/aldi-us/aldi-us-category' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"postal_code":"60174","slug":"n-milk-33852"}}'响应字段
collectionidnameslugurl
products[]product_iditem_idnamebrandsizeurlimagecurrencypriceprice_displayoriginal_pricediscount_percentsavingsunit_price_textprice_is_estimateestimated_weight_textpromotions[]deal_termsavailablestock_levelstock_labellikely_out_of_stocksold_bydietary[]store_brandbadgeservice_typematches_queryretailershop_idservice_typeretailer_location_id
counttotalpageper_pagelast_pagehas_morestorestore_idnamestreetcity_state_ziplatitudelongitude
service_typepostal_codestore_defaultedcurrency
每周特惠与 ALDI Finds
POST /api/v1/aldi-us/aldi-us-offers
读取 ALDI 当前的每周特惠、本周或下周的 ALDI Finds,或降价商品列表,按所选门店计价。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.cursor | string | 可选 | — | — | — |
body.date | string | 可选 | — | — | — |
body.page | integer | 可选 | 1 | — | 1–200 |
body.per_page | integer | 可选 | 20 | — | 1–40 |
body.postal_code | string | 可选 | — | — | — |
body.service_type | string | 可选 | "delivery" | "delivery""in_store""pickup" | — |
body.store_id | string | 可选 | — | — | — |
body.type | string | 可选 | "weekly_ad" | "weekly_ad""aldi_finds""upcoming_aldi_finds""price_drops" | — |
请求示例
# 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/aldi-us/aldi-us-offers' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"postal_code":"60174","type":"weekly_ad"}}'响应字段
typecollectionidnameslugurl
finds_dateproducts[]product_iditem_idnamebrandsizeurlimagecurrencypriceprice_displayoriginal_pricediscount_percentsavingsunit_price_textprice_is_estimateestimated_weight_textpromotions[]deal_termsavailablestock_levelstock_labellikely_out_of_stocksold_bydietary[]store_brandbadgeservice_typematches_queryretailershop_idservice_typeretailer_location_id
counttotalpagehas_morestorestore_idnamestreetcity_state_ziplatitudelongitude
service_typepostal_codestore_defaultedcurrency
商品详情
POST /api/v1/aldi-us/aldi-us-product-detail
读取单个 ALDI 商品的完整详情——配料、营养成分与图片——以及其在所选门店的价格与库存。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.product_id | string | 必填 | — | — | — |
body.postal_code | string | 可选 | — | — | — |
body.service_type | string | 可选 | "delivery" | "delivery""in_store""pickup" | — |
body.store_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/aldi-us/aldi-us-product-detail' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"postal_code":"60174","product_id":"16902710"}}'当前生效的促销列表
POST /api/v1/aldi-us/aldi-us-promotions
列出 ALDI 当前生效的促销列表——每周特惠、ALDI Finds、降价商品——并给出各自的商品数量。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.postal_code | string | 可选 | — | — | — |
body.service_type | string | 可选 | "delivery" | "delivery""in_store""pickup" | — |
body.store_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/aldi-us/aldi-us-promotions' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"postal_code":"60174"}}'响应字段
promotions[]typenameslugurlfinds_dateproduct_countavailable
storestore_idnamestreetcity_state_ziplatitudelongitude
service_typepostal_codestore_defaultedcurrency
商品搜索
POST /api/v1/aldi-us/aldi-us-search
按关键词搜索 aldi.us 的杂货商品范围,按所选门店计价,支持分页。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.query | string | 必填 | — | — | — |
body.cursor | string | 可选 | — | — | — |
body.include_unmatched | boolean | 可选 | false | — | — |
body.page | integer | 可选 | 1 | — | 1–200 |
body.per_page | integer | 可选 | 20 | — | 1–40 |
body.postal_code | string | 可选 | — | — | — |
body.service_type | string | 可选 | "delivery" | "delivery""in_store""pickup" | — |
body.store_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/aldi-us/aldi-us-search' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"postal_code":"60174","query":"milk"}}'响应字段
products[]product_iditem_idnamebrandsizeurlimagecurrencypriceprice_displayoriginal_pricediscount_percentsavingsunit_price_textprice_is_estimateestimated_weight_textpromotions[]deal_termsavailablestock_levelstock_labellikely_out_of_stocksold_bydietary[]store_brandbadgeservice_typematches_queryretailershop_idservice_typeretailer_location_id
counttotalpageper_pagelast_pagehas_moreunmatched_droppedquerystorestore_idnamestreetcity_state_ziplatitudelongitude
service_typepostal_codestore_defaultedcurrency
门店定位
POST /api/v1/aldi-us/aldi-us-stores
按美国邮编查找附近的 ALDI 门店,按距离由近到远排列,并给出每家门店的配送、取货与店内购物的可用情况。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.postal_code | string | 必填 | — | — | — |
body.limit | integer | 可选 | 20 | — | 1–100 |
body.page | integer | 可选 | 1 | — | 1–200 |
请求示例
# 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/aldi-us/aldi-us-stores' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"postal_code":"10001"}}'响应字段
stores[]store_idnamestreetcity_state_zippostal_codelatitudelongitudedistance_milesservice_types[]services_textunavailable_text
counttotalpagehas_more
调用方式
- 使用
POST /api/v1/aldi-us/<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 小时内返回已保存的响应,不会再次扣费。
网关调用参考: