# 获取橱窗商品详情
接口应在服务器端调用,不可在前端(小程序、网页、APP等)直接调用,具体可参考接口调用指南
接口英文名:getwindowproduct
通过该接口可获取橱窗商品详情。
增加 leaf_category_id 字段(与 third_category_id 同级),表示叶子类目(品类)ID,旧的 third_category_id 最终会下掉,请尽快迁移
# 1. 调用方式
# HTTPS 调用
POST https://api.weixin.qq.com/channels/ec/window/product/get?access_token=ACCESS_TOKEN
# 云调用
调用方法:channels.ec.window.product.get
出入参和 HTTPS 调用相同,调用方式可查看 云调用 说明文档
# 第三方调用
本接口支持第三方平台代商家调用。
该接口所属的权限集 id 为:133、177
服务商获得其中之一权限集授权后,可通过使用 authorizer_access_token 代商家进行调用,具体可查看 第三方调用 说明文档。
# 2. 请求参数
# 查询参数 Query String parameters
| 参数名 | 类型 | 必填 | 示例 | 说明 |
|---|---|---|---|---|
| access_token | string | 是 | ACCESS_TOKEN | 接口调用凭证,可使用 access_token、authorizer_access_token |
# 请求体 Request Payload
| 参数名 | 类型 | 必填 | 说明 |
|---|---|---|---|
| product_id | string(uint64) | 是 | 橱窗商品ID |
| appid | string | 是 | 商品来源店铺的appid,need_cps_product为true时可留空, 否则必填 |
| need_cps_product | bool | 否 | 是否查询带货商品 |
# 3. 返回参数
# 返回体 Response Payload
| 参数名 | 类型 | 说明 |
|---|---|---|
| errcode | number | 错误码 |
| errmsg | string | 错误信息 |
| product | object | 橱窗商品详情,结构体详情请参考Product |
| cps_products | objarray | 橱窗中的带货商品详情(详见"关于橱窗中的带货商品") |
# Res.product Object Payload
橱窗商品详情,结构体详情请参考Product
| 参数名 | 类型 | 说明 |
|---|---|---|
| product_id | string | 对于自营商品为橱窗商品ID; 对于带货商品为带货商品ID |
| out_product_id | string | 对于自营商品为商家侧外部商品ID; 对于带货商品则为商品在货源店铺的商品ID |
| title | string | 商品标题 |
| img_url | string | 商品头图url |
| third_category_id | string | 商品所属三级类目ID |
| leaf_category_id | string | 商品所属叶子类目(品类)ID |
| status | number | 商品状态,枚举值详情请参考下文 |
| market_price | number | 价格区间最大值(单位分) (市场价,原价) |
| selling_price | number | 价格区间最小值(单位分) (销售价) |
| stock | number | 剩余库存 |
| sales | number | 销量 |
| appid | string | 商品来源店铺的appid(非带货商品才拥有) |
| page_path | object | page_path |
| platform_id | number | 商品所属电商平台ID |
| platform_name | string | 商品所属电商平台名 |
| is_hide_for_window | boolean | 是否在个人橱窗页隐藏 |
| banned | boolean | 商品是否处于禁止售卖的状态 |
| banned_details | object | banned_details |
| branch_info | object | branch_info |
| limit_discount_info | object | limit_discount_info |
| cps_item_type | number | 对于带货商品会返回, 代表所属计划的类型请参考下文 |
| product_promotion_link | string | 用于在小程序跳转小店场景添加商品时传递跟佣信息 |
# Res.cps_products(Array) Object Payload
橱窗中的带货商品详情(详见"关于橱窗中的带货商品")
| 参数名 | 类型 | 说明 |
|---|---|---|
| product_id | string | 对于自营商品为橱窗商品ID; 对于带货商品为带货商品ID |
| out_product_id | string | 对于自营商品为商家侧外部商品ID; 对于带货商品则为商品在货源店铺的商品ID |
| title | string | 商品标题 |
| img_url | string | 商品头图url |
| third_category_id | string | 商品所属三级类目ID |
| leaf_category_id | string | 商品所属叶子类目(品类)ID |
| status | number | 商品状态,枚举值详情请参考下文 |
| market_price | number | 价格区间最大值(单位分) (市场价,原价) |
| selling_price | number | 价格区间最小值(单位分) (销售价) |
| stock | number | 剩余库存 |
| sales | number | 销量 |
| appid | string | 商品来源店铺的appid(非带货商品才拥有) |
| platform_id | number | 商品所属电商平台ID |
| platform_name | string | 商品所属电商平台名 |
| is_hide_for_window | boolean | 是否在个人橱窗页隐藏 |
| banned | boolean | 商品是否处于禁止售卖的状态 |
| cps_item_type | number | 对于带货商品会返回, 代表所属计划的类型请参考下文 |
| product_promotion_link | string | 用于在小程序跳转小店场景添加商品时传递跟佣信息 |
# Res.product.page_path Object Payload
page_path
| 参数名 | 类型 | 说明 |
|---|---|---|
| appid | string | 商品详情半屏页、全屏页所属appid |
| half_page_path | string | 商品详情半屏页path |
| full_page_path | string | 商品详情全屏页path |
# Res.product.banned_details Object Payload
banned_details
| 参数名 | 类型 | 说明 |
|---|---|---|
| reason | number | 禁售原因,枚举值详情请参考下文 |
| need_apply_category_id | string | 未申请售卖对应商品类目时带有,需要申请的类目ID |
| need_apply_category_name | string | 未申请售卖对应商品类目时带有,需要申请的类目名 |
# Res.product.branch_info Object Payload
branch_info
| 参数名 | 类型 | 说明 |
|---|---|---|
| branch_id | number | 分店ID |
| branch_name | string | 分店名 |
| branch_status | number | 分店状态,枚举值详情请参考下文 |
# Res.product.limit_discount_info Object Payload
limit_discount_info
| 参数名 | 类型 | 说明 |
|---|---|---|
| is_effect | boolean | 是否有生效中的抢购活动 |
| discount_price | number | 抢购价 |
| end_time_ms | string | 抢购活动结束时间(毫秒时间戳) |
| stock | number | 抢购剩余库存 |
# 4. 注意事项
关于橱窗商品ID的说明
橱窗商品ID即在视频号助手web端,橱窗列表中展示的商品ID。具体的分为两种情况:
1、对于自营商品,橱窗ID即为小店商品ID,是小店在上传商品的时候,平台给的唯一商品ID,获取方式为小店后台-商品规格,或通过小店商品详情API获取
2、对于带货商品,橱窗ID为货源商品在小店的商品ID。此外带货商品会额外拥有一个带货商品ID,是小店在创建带货计划的时候,平台给的此计划对应的商品ID,获取方式为小店带货商品详情API,或视频号助手商品详情API等
每个带货商品ID唯一对应一个带货商品,而同一个货源商品ID可能对应多个带货商品,具体详见"关于橱窗中的带货商品"部分
关于橱窗中的带货商品
目前接口支持了橱窗中带货商品详情的返回,填写 need_cps_product = true 后,product_id 字段同时支持根据前述两种商品ID查询,不过需要注意的是:
1、若输入小店商品ID,则能够获取此商品的所有带货计划
2、若输入带货商品ID,则只能获取该带货商品的计划
带货商品会被单独返回在 cps_products 列表中,同时返回带货计划的类型
status商品状态
| 枚举值 | 描述 |
|---|---|
| 1 | 已上架到橱窗 |
| 2 | 未上架到橱窗 |
| 3 | 已在商品来源处删除 |
reason禁售原因
| 枚举值 | 描述 |
|---|---|
| 0 | 三级类目在橱窗禁售 或 商品在来源处被禁售 |
| 1 | 商品属于可申请售卖的类目,但商家未完成申请 |
| 2 | 商品所属分店未处于营业状态 |
branch_status分店状态
| 枚举值 | 描述 |
|---|---|
| 0 | 营业中 |
| 1 | 停业 |
cps_item_type带货计划类型
| 枚举值 | 描述 |
|---|---|
| 0 | 普通计划 |
| 1 | 定向计划 |
| 2 | 专属计划 |
| 3 | 团长计划 |
# 5. 代码示例
请求示例
{
"product_id": "100234056",
"appid": "wxee9f94a3360ad25f",
"need_cps_product": true
}
返回示例
{
"errcode": 0,
"errmsg": "ok",
"product": {
"product_id": "100234056",
"out_product_id": "out_100234056",
"title": "任天堂 Nintendo Switch 国行续航增强版 NS家用体感游戏机掌机 便携掌上游戏机 红蓝主机",
"img_url": "https://mmecimage.cn/p/wx37f38d59298839c3/HJE9eJaEc5bJk-eaArVdILSB7MMaHgdK2-JIn51nMQ",
"third_category_id": 6091,
"leaf_category_id": 6091,
"status": 1,
"market_price": 1500,
"selling_price": 1300,
"stock": 100,
"sales": 888,
"appid": "wxee9f94a3360ad25f",
"page_path": {
"appid": "wxee9f94a3360ad25f",
"half_page_path": "pages/buy/productDetail?productId=2176180",
"full_page_path": "pages/productDetail/productDetail?productId=2176180"
},
"platform_id": 0,
"platform_name": "我的小店",
"is_hide_for_window": 0,
"banned": false,
"limit_discount_info": {
"is_effect": true,
"discount_price": 1300,
"end_time_ms": 1666086005500,
"stock": 10
}
},
"cps_products": [
{
"product_id": "100234056",
"out_product_id": "out_100234056",
"title": "任天堂 Nintendo Switch 国行续航增强版 NS家用体感游戏机掌机 便携掌上游戏机 红蓝主机",
"img_url": "https://mmecimage.cn/p/wx37f38d59298839c3/HJE9eJaEc5bJk-eaArVdILSB7MMaHgdK2-JIn51nMQ",
"third_category_id": 6091,
"leaf_category_id": 6091,
"status": 1,
"market_price": 1500,
"selling_price": 1300,
"stock": 100,
"sales": 888,
"appid": "wxee9f94a3360ad25f",
"platform_id": 0,
"platform_name": "我的小店",
"is_hide_for_window": 0,
"banned": false,
"cps_item_type": 1,
"product_promotion_link": "v1=HAOHK025pGFF8tBx69zbwNpU473uiTNa5MOHrs_Hknqa_-Cjk9IbBHMHeKh5rSnIrQ"
}
]
}
# 6. 错误码
以下是本接口的错误码列表,其他错误码可参考 通用错误码;调用接口遇到报错,可使用官方提供的 API 诊断工具 辅助定位和分析问题。
| 错误码 | 错误描述 |
|---|---|
| 48001 | 接口权限未开启,需前往视频号助手- 开放能力-开放场景 打开开关 |
| 10022001 | 验证视频号身份失败, 请检查是否使用视频号橱窗ID请求 |
| 10022002 | 因违规行为, 橱窗被禁止使用, 请前往'带货中心->个人中心->带货权限'检查橱窗带货权限 |
| 10022003 | 橱窗商品未找到 |
| 10022007 | 不支持操作带货中心来源的商品 |
| 10022008 | 请求的appid不属于该视频号的绑定店铺 |
# 7. 适用范围
本接口支持「视频号助手」账号类型调用。其他账号类型如无特殊说明,均不可调用。