开发文档
BİM API 技术参考
BİM API 参考:如何选定宣传单、各输入的作用,以及宣传单、海报、商品、品牌和门店结果所包含的字段。
另见: BİM 折扣超市数据接口概览与价格 · BİM API 指南:宣传单、商品、海报与门店
本页内容
BİM API 宣传单列表:标识键、日期与状态值
bim-leaflets 是宣传单标识键唯一的来源,因为 BİM 不保留存档,只会响应它当前列出的那些宣传单的键。body.type 把列表限定为一个类别,列表中包含近期的、当前的和即将开始的宣传单。leaflets 的每一项都有这些字段:
leaflet_key:作为body.leaflet_key发给bim-leaflet-products的标识type与date_label:类别,以及 BİM 自己的日期文字starts_on与ends_on:年份为推断值的 ISO 日期,因为 BİM 只印日和月,year_inferred会显示这一点weekday、is_current与days_from_today:星期几、这张宣传单是否为当前那一张,以及它与今天相差的天数status:current、upcoming、today或past,其中current是 BİM 自己的网站正在展示的那一张url:这张宣传单的地址
在条目之外,current_leaflet_key 是当前那一张的键,today 是伊斯坦布尔的日期,types_present 指出出现的类别。
本节涉及的字段(2)
bim-leaflets, body.type
选定要读取的宣传单
bim-leaflet-products 每次调用读取一张宣传单,并提供三种选定方式。body.leaflet_key 按标识指定宣传单,body.date 请求 BİM 为那一天发布的宣传单,两者都不发送则返回今天在架的那一张。body.type 只在没有发送键时起作用,发送了 body.leaflet_key 时它会被忽略。
对 bim-leaflets 没有列出的键,BİM 会显示当前的宣传单,所以操作会拒绝这样的键,而不是返回错误那一周的商品。
BİM 会同时保留一张时间较长的 indirim 宣传单和一张每周的。当一个日期落在两者的有效期内时,返回的是开始日期最接近该日期的那一张,要读取另一张,就用 bim-leaflets 中的键。未来的日期也可以使用,因为 BİM 会提前几天发布即将开始的宣传单。
本节涉及的字段(4)
bim-leaflet-products, body.leaflet_key, body.date, body.type
商品行字段与折扣数据
在 bim-leaflet-products 的商品行中,price 是以里拉计的数字,currency 重复标明币种。有三个字段承载折扣,它们的生成方式各不相同:
price_before_discount:划线价,在indirim宣传单上有值,在每一张aktuel宣传单上为 null,因为 BİM 在那里不印划线价discount_percent:BİM 印出的百分比,会被截断discount_percent_calculated:用两个价格算出的精确结果,没有划线价时为 null
一行中的其他字段用来标识商品:product_id、title、image、slug 和 url。结果中的 leaflet 块重复 bim-leaflets 为每个条目给出的宣传单字段。
BİM 没有填写品牌时 brand 为 null,这种品牌常常写在 title 中。products_without_price 列出 BİM 没有印价格的商品,banner_tiles 是从不计入商品的广告块。
本节涉及的字段(1)
bim-leaflet-products
海报标签与海报的内容
bim-posters 用 body.type 选择海报标签,保持默认值则返回各个标签下的海报。海报是扫描得到的印刷版宣传单。在 posters 中,type 指明它所属的标签,label 是 BİM 的日期标注,cover_image 是封面图。
page_images 按顺序列出页面图片,page_count 显示海报有多少页,download_url 是 BİM 自己提供的下载链接。count 统计海报的数量,counts_by_type 按标签拆分这个数量,total_pages 是页数总计。bim-leaflet-products 以结构化数据行返回同一次活动,但它的 body.type 取 aktuel 或 indirim。
本节涉及的字段(2)
bim-posters, body.type
按链接或 slug 查找单个商品
bim-product-detail 通过 body.url(商品地址)或 body.slug(仅 slug 部分)查找商品,product_url 被接受为 body.url 的替代名称。BİM 的商品页只在其宣传单有效期间存在,所以应从 bim-leaflet-products 取新的值,而不是存下来备用。宣传单已过期的商品会被拒绝。
body.include_brand 控制是否多读一次商品所在的宣传单。为 true 时,brand 与 leaflet 块会被填上;为 false 时只读取商品页,brand 与 leaflet 为 null,brand_source 的值是 not_requested。product 块包含:
product_id、title、package_size、slug与url:商品的标识和包装规格features:特点要点,往往比宣传单上的商品块更长price、price_before_discount、discount_percent与discount_percent_calculated:价格数据,含义与宣传单商品行中相同currency与max_interest_free_installments:TRY,以及最多可选的免息分期期数image与images:单张图片,以及商品的各张图片
本节涉及的字段(4)
bim-product-detail, body.url, body.slug, body.include_brand
门店查询的层级与输入
bim-stores 每增加一个输入就深入一层,不带输入时返回 BİM 所服务的 81 个省份。body.city 接受省份名称或 BİM 的数字省份 id,body.county 接受区县名称或数字区县 id,district 被接受为 body.county 的替代名称。不带 body.county 时,调用返回该省份的区县;只给省份不会返回门店,所以要得到门店,必须再给出区县。
level 说明返回的是哪一个列表,每个列表有各自的条目:
cities与counties:每个省份或区县的id和namestores:每家门店的name、address、city和countyreported_count:BİM 自己报告的门店数,与count并列
本节涉及的字段(3)
bim-stores, body.city, body.county
品牌类别与自有品牌
body.category 接受类别 slug,或取自同一操作 categories 列表的数字 id,所以要先做不带输入的那次调用。不带类别时结果是 categories,每一项有 category_id、slug、name 和 url。
带上类别时结果是 brands,每一项有品牌的 name 和 logo,并附有重复所选类别的 category,以及 BİM 自己对该类别的介绍文字 description。level 用来区分这两种结果,count 统计条目数。
本节涉及的字段(2)
bim-brands, body.category
max_rotations 输入
body.max_rotations 是一个高级输入,用来设定操作尝试的次数。超出范围的值会被忽略并采用默认值,因此发送了这种值的请求仍会照常执行。这个 API 的每个操作都有这个输入。
本节涉及的字段(1)
body.max_rotations
操作
公共网关操作统一使用 POST /api/v1/{project}/{action}。
使用 JSON 对象,按文档将参数放入 path、query、headers 和 body,省略未使用的位置。input.headers 是供操作使用的 JSON 数据,不是浏览器请求头。请勿在此填写凭证。按文档保留 body 的数组、标量或 null;省略与 null 含义不同。
自有品牌
POST /api/v1/bim/bim-brands
列出 BİM 的商品类别,再读取单个类别下自有品牌的名称与标志。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.category | string | 可选 | — | — | — |
body.max_rotations | integer | 可选 | 3 | — | 1–8 |
请求示例
# 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/bim/bim-brands' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"category":"sut-ve-sut-urunleri"}}'宣传单商品
POST /api/v1/bim/bim-leaflet-products
读取单张宣传单的商品行,含价格、包装规格、特点要点和分期信息。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.date | string | 可选 | — | — | — |
body.leaflet_key | integer | 可选 | — | — | 1–9007199254740991 |
body.max_rotations | integer | 可选 | 3 | — | 1–8 |
body.type | string | 可选 | "aktuel" | "aktuel""indirim" | — |
请求示例
# 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/bim/bim-leaflet-products' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"type":"aktuel"}}'宣传单列表
POST /api/v1/bim/bim-leaflets
列出当前、即将开始和近期的宣传单,含标识键、日期和状态。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.max_rotations | integer | 可选 | 3 | — | 1–8 |
body.type | string | 可选 | "all" | "all""aktuel""indirim" | — |
请求示例
# 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/bim/bim-leaflets' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"type":"all"}}'宣传单海报
POST /api/v1/bim/bim-posters
以封面图和页面图片的形式返回印刷版宣传单,并附 BİM 的下载链接。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.max_rotations | integer | 可选 | 3 | — | 1–8 |
body.type | string | 可选 | "all" | "all""aktuel""indirim""kirtasiye" | — |
请求示例
# 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/bim/bim-posters' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"type":"all"}}'商品详情
POST /api/v1/bim/bim-product-detail
按链接或 slug 读取单个宣传单商品,含图片、特点要点和品牌。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.include_brand | boolean | 可选 | true | — | — |
body.max_rotations | integer | 可选 | 3 | — | 1–8 |
body.slug | string | 可选 | — | — | — |
body.url | 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/bim/bim-product-detail' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"url":"https://www.bim.com.tr/aktuel-urunler/darel-calisma-masasi-14-9/aktuel.aspx"}}'门店查询
POST /api/v1/bim/bim-stores
列出省份、某省份的区县,以及某区县的门店。
输入字段
| 字段 | 类型 | 是否必填 | 默认值 | 允许的值 | 范围限制 |
|---|---|---|---|---|---|
body.city | string | 可选 | — | — | — |
body.county | string | 可选 | — | — | — |
body.max_rotations | integer | 可选 | 3 | — | 1–8 |
请求示例
# 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/bim/bim-stores' \
--header "Content-Type: application/json" \
--header "x-api-key: $KAKIAPI_API_KEY" \
--header "Idempotency-Key: $REQUEST_ID" \
--data '{"body":{"city":"İstanbul","county":"Kadıköy"}}'调用方式
- 使用
POST /api/v1/bim/<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 小时内返回已保存的响应,不会再次扣费。
网关调用参考: