开发

从物料库查询带货物料

接口功能

从物料库查询带货物料

URL

https://openapi.baidu.com/rest/2.0/smartapp/osa/fy/material

调用方式

POST

是否可重入


请求参数说明

字段 类型 是否必须 字段定义 备注
union_sign String 签名,公参 生成方式见签名说明
union_timestamp Long 当前时间戳,公参 当前请求时间(精确到秒)
union_nocestr String 随机字符串,公参 每次请求生成一个新的随机字符串,随机串长度不能超过64位,可以有数字、字母、连接符、- 组成
access_token String 校验,公参 生成方式见access_token获取

请求体说明

字段 类型 是否必须 字段定义 备注
page_no Integer 页码
page_size Integer 分页大小 默认10条
app_key String 小程序appkey
popularize_type Long 分佣品类字段 参见小程序分佣推广平台类目对照表
name String 商品名称
channel String 渠道 开源宿主固定传300000
outer_spu_id String 商品外部id
mid String 物料id
is_hotlist Integer 是否是热榜 1-是 0-否
channel_is_cps Integer 是参与分佣 1-是 0-否
first_category String 品类(如:图书) 1-是 0-否

请求body示例POST/JSON

1
2
3
4
5
6
7
8
9
10
{
"page_no":1,
"page_size":50,
"app_key":"O4S7pP7HtQZtzA80zyycZYv4tDnSGL3b",
"popularize_type":1,
"name":"testname",
"channel":"300000",
"outer_spu_id":"1643593",
"mid":"13013286428"
}

返回字段说明

字段 类型 字段定义 备注
err_no int 错误码 0表示请求成功
msg String 返回信息
timestamp Long 返回时的时间戳 单位,秒
request_id String 日志id
data JSONObject 分页数据对象 参见data对象字段定义

data对象字段定义

字段 类型 字段定义 备注
total Long 资源总条数
page_no Integer 当前页码
page_size Integer 每页数量
page_count Integer 总页数
list List 数据对象列表 参见list字段定义

list字段定义

字段 类型 字段定义 备注
app_key String 小程序appkey
mid String 物料id
path String 物料path
name String 商品名称
title String 商品标题
desc String 商品描述
brand String 商品品牌
outer_spu_id String 商品外部ID
stock Long 商品库存
score Byte 商品评分
images List 开发者提交图片信息 参见images字段定义
sales_info JSONObject 销量信息 参见sales_info字段定义
category_info JSONObject 类目信息 参见category_info字段定义
price_infos List 价格信息 参见price_infos字段定义
schema String 开发者扩展字段 业务自己识别(JSON字符串)
ext String 扩展字段 业务自己识别(JSON字符串)
create_time Long 创建时间 时间戳,单位毫秒
update_time Long 更新时间 时间戳,单位毫秒

images字段定义

字段 类型 字段定义 备注
image_type String 图片类型 类型取值:VERTICAL_IMG:竖图;BIG_IMG:大图;SMALL_IMG:小图;LIVING_IMG:直播轮播图;CAROUSEL_IMG:轮播图
url String 图片地址
height Integer 高度 图片高度,单位:px
width Integer 宽度 图片宽度,单位:px
size Integer 大小 图片存储大小,单位:byte

sales_info字段定义

字段 类型 字段定义 备注
sales_30 Long 30天销量

category_info字段定义

字段 类型 字段定义 备注
first_category String 商品一级类目
second_category String 商品二级类目
third_category String 商品三级类目
fourth_category String 商品四级类目

price_infos字段定义

字段 类型 字段定义 备注
org_price String 原始价格 本商品原价(单位:分),即"100"代表1元
real_price String 现价 本商品现价(单位:分),即"100"代表1元

返回结果示例

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{
"err_no": 0,
"msg": "success",
"timestamp": 1614743282,
"request_id": "b1a624d2d93e46a48cfc1d2080ef7fe0",
"data": {
"total": 75,
"page_no": 2,
"page_size": 1,
"page_count": 75,
"list": [
{
"app_key": "pYiXbY1koi1PH5AIgpEAZTOyq7MI1lmA",
"mid": "1940084679229852934",
"path": "/xytest01",
"name": "洗发水",
"title": "洗发水",
"desc": "",
"brand": "海飞丝",
"outer_spu_id": "shopid_001",
"stock": 1000,
"score": 3,
"images": [
{
"image_type": "BIG_IMG",
"url": "https://mbs1.bdstatic.com/miniapp/resource/image/20210302/10775d92-c0e3-4128-8b61-6f7e0068f6f5.jpg",
"height": 96,
"width": 100,
"size": 5000
},
{
"image_type": "SMALL_IMG",
"url": "https://mbs1.bdstatic.com/miniapp/resource/image/20210302/10775d92-c0e3-4128-8b61-6f7e0068f6f5.jpg",
"height": 96,
"width": 10,
"size": 1000
},
{
"image_type": "CAROUSEL_IMG",
"url": "https://mbs1.bdstatic.com/miniapp/resource/image/20210302/c90a694e-a14d-463b-980f-ff52129165ea.jpg",
"height": 682,
"width": 10,
"size": 10000
}
],
"sales_info": {
"sales_30": 255
},
"category_info": {
"first_category": "电商",
"second_category": "食品",
"third_category": "",
"fourth_category": ""
},
"price_infos": [
{
"org_price": "10000",
"real_price": "9020"
}
],
"schema": "",
"ext": "",
"create_time": 1612666928851,
"update_time": 1614673834848
}
]
}
}