May 18, 2021 WeChat Mini Program Development Document
Name | Description of the function |
---|---|
Create a live room | The interface creates the live room directly, and after the success of the creation, the live room will be displayed in the live room list |
Get a list of live rooms | This interface provides a list of live rooms |
Get live interstation playback | The interface provides playback source video at the end of the live broadcast |
Import items between live streams | Call this interface to import stored items to the specified live stream |
The live-streaming interface is the interface capability that a small program-live program provides to developers to perform bulk operations on the live-streaming room. Developers can create live rooms, get live-streaming information, get live-streaming replays, and import products into live-streaming rooms.
Call this interface to create a live room, which will be displayed in the live room list after successful creation
Call limit: 10000 times/day
POST
https://api.weixin.qq.com/wxaapi/broadcast/room/create?access_token=
{
name: "测试直播房间1", // 房间名字
coverImg: "", // 通过 uploadfile 上传,填写 mediaID
startTime: 1588237130, // 开始时间
endTime: 1588237130 , // 结束时间
anchorName: "zefzhang1", // 主播昵称
anchorWechat: "WxgQiao_04", // 主播微信号
shareImg: "" , //通过 uploadfile 上传,填写 mediaID
type: 1 , // 直播类型,1 推流 0 手机直播
screenType: 0, // 1:横屏 0:竖屏
closeLike: 0 , // 是否 关闭点赞 1 关闭
closeGoods: 0, // 是否 关闭商品货架,1:关闭
closeComment: 0 // 是否开启评论,1:关闭
}
Parameters | Type | Required | Description |
---|---|---|---|
name | String | Is | Live room name, the shortest 3 Characters, the longest 17 Chinese characters, 1 Chinese character equivalent to 2 characters |
coverImg | String | Is | Background map, fill in media https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html ID (mediaID obtained, valid for three days); |
startTime | Number | Is | Live scheduled start time (start time needs to be 10 minutes after the current time and cannot start after 6 months) |
endTime | Number | Is | Live schedule end time (no shorter than 30 minutes and no more than 24 hours between start and end) |
anchorName | String | Is | Host nickname, the shortest 2 Characters, the longest 15 Chinese characters, 1 Chinese character equivalent to 2 characters |
anchorWechat | String | Is | Host microsyscope, if not real-name authentication, you need to go to the "small program live" small program for real-name verification, small program QR code link: https://res.wx.qq.com/op_res/BbVNeczA1XudfjVqCVoKgfuWe7e3aUhokktRVOqf_F0IqS6kYR--atCpVNUUC3zr |
subAnchorWechat | String | Whether | Host sub-signal microscope, if not real-name authentication, you need to go to the "small program live" small program for real-name verification, small program QR code link: https://res.wx.qq.com/op_res/BbVNeczA1XudfjVqCVoKgfuWe7e3aUhokktRVOqf_F0IqS6kYR--atCpVNUUC3zr |
createrWechat | String | Whether | Creator microscope |
shareImg | String | Is | Share the map, fill in the media https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html ID (mediaID, valid for three days); |
feedsImg | String | Whether | Shopping live channel cover map, fill in mediaID (mediaID obtained, valid for https://developers.weixin.qq.com/doc/offiaccount/Asset_Management/New_temporary_materials.html); Shopping live channel cover map, picture rules: suggested pixels 800 x 800, size not more than 100KB; |
isFeedsPublic | Number | Whether | Whether to turn on official inging 1: on, 0: off, turn on ingies by default |
type | Number | Is | Live Room Type 1: Push Stream, 0: Mobile Live |
screenType | Number | Is | Horizontal screen, vertical screen 1: horizontal screen, 0: vertical screen (horizontal screen: video aspect ratio of 16:9, 4:3, 1.85:1; vertical screen: video aspect ratio of 9:16, 2:3) |
closeLike | Number | Is | Whether to turn off likes 0: On, 1: Off (if off, live streaming is not allowed to turn on after it starts) |
closeGoods | Number | Is | Whether to close the shelf 0: on, 1: off (if closed, live streaming is not allowed to turn on after the start) |
closeComment | Number | Is | Do you want to turn off comments: 0: On, 1: Off (if closed, live streaming is not allowed to turn on after it starts) |
closeReplay | Number | Whether | Whether to turn playback off by default. 0: On, 1: Off |
closeShare | Number | Whether | Whether to turn off sharing 0: On, 1: Off: Turn on sharing by default (no modification is allowed after live streaming starts) |
closeKf | Number | Whether | Whether to turn off customer service 0: on, 1: off by default to turn off customer service |
{
"roomId": 33, //房间ID
"errcode": 0
}
Parameters | Description |
---|---|
roomId | Room ID |
qrcode_url | "Small program live" small program code |
Call this interface to get a list of live streams and information between live broadcasts
Call limit: 100,000 times/day (shared with the get playback interface)
POST
https://api.weixin.qq.com/wxa/business/getliveinfo?access_token=
{
"start": 0, // 起始拉取房间,start = 0 表示从第 1 个房间开始拉取
"limit": 10 // 每次拉取的个数上限,不要设置过大,建议 100 以内
}
Parameters | Type | Required | Description |
---|---|---|---|
start | Number | Is | Starting room, 0 indicates pulling from room 1 |
limit | Number | Is | The number of rooms pulled each time is recommended within 100 |
{
"errcode": 0, // 错误码,0代表成功,1代表未创建直播间
"errmsg": "ok" // 错误信息
"room_info":[{
"name":"直播房间名"
"roomid": 1,
"cover_img":"http://http:\/\/mmbiz.qpic.cn\/mmbiz_jpg\Rl1RuuhdstSfZa8EEljedAYcbtX3Ejpdl2et1tPAQ37bdicnxoVialDLCKKDcPBy8Iic0kCiaiaalXg3EbpNKoicrweQ\/0?wx_fmt=jpeg",
"share_img":"http://http:\/\/mmbiz.qpic.cn\/mmbiz_jpg\Rl1RuuhdstSfZa8EEljedAYcbtX3Ejpdl2et1tPAQ37bdicnxoVialDLCKKDcPBy8Iic0kCiaiaalXg3EbpNKoicrweQ\/0?wx_fmt=jpeg",
"live_status": 101,
"start_time": 1568128900,
"end_time": 1568131200,
"anchor_name":"里斯",
"goods":[{
"cover_img":"http://http:\/\/mmbiz.qpic.cn\/mmbiz_jpg\/Rl1RuuhdstSfZa8EEljedAYcbtX3Ejpdl2et1tPAQ37bdicnxoVialDLCKKDcPBy8Iic0kCiaiaalXg3EbpNKoicrweQ\/0?wx_fmt=jpeg",
"url":"pages/index/index.html",
"price":1100,
"name":"茶杯"}],
"total":1
}]
}
Room parameters
Parameters | Description |
---|---|
name | The name of the live broadcast room |
roomid | Live ID |
cover_img | Link to background map between live streams |
share_img | Share a link to the map between live streams |
live_status | Live interstation status. 101: Live, 102: Not Started, 103 Ended, 104 Banned, 105: Pause, 106: Abnormal, 107: Expired |
start_time | The start time between live broadcasts, with the list start_time descending order of the event |
end_time | The end time of the live broadcast schedule |
anchor_name | The anchor name |
total | Pull the total number of rooms |
Product parameters
Parameters | Description |
---|---|
cover_img | Product cover photo link |
Url | The commodity program path |
price | Commodity prices |
name | The name of the product |
Call the interface to get playback source video between end-of-live broadcasts (typically generated within 10 minutes of the end of the live stream, no comments on the feed video, etc.)
Call quota: 100000 times / day
POST
https://api.weixin.qq.com/wxa/business/getliveinfo?access_token=
{
"action": "get_replay",
"room_id": 354,
"start": 0,
"limit": 10
}
Parameters | Type | Required | Description |
---|---|---|---|
action | String | Is | Get playback |
room_id | Number | Is | Live ID |
start | Number | Is | Start pull video, 0 indicates pull from the first video clip |
limit | Number | Is | The number of pulls per pull is recommended within 100 |
{
"live_replay":[{
"expire_time":"",
"create_time":"",
"media_url":""
}],
"errcode": 0,
"total": 1,
"errmsg":"ok"
}
Parameters | Description |
---|---|
expire_time | Play back the video url expiration time |
create_time | Play back when the video was created |
media_url | Play back the video link |
total | The number of video clips played back |
Call the interface to import the stored items to the specified live broadcast room
Call limit: 10000 times/day
POST
https://api.weixin.qq.com/wxaapi/broadcast/room/addgoods?access_token=
{
"ids": [1150, 1111], // 数组列表,可传入多个,里面填写 商品 ID
"roomId": 2554
}
Parameters | Type | Required | Description |
---|---|---|---|
Ids | Array<Number> | Is | Array list, can be passed in more than one, fill in the product ID |
roomId | Number | Is | Room ID |
{
"errcode": 0 // 0:成功
}
-1: System error
1: No live room was created
1003: The product id does not exist
47001: The entry format does not conform to the specification
200002: Entry error
300001: Do not create/update merchandise or edit and update rooms
300002: The name length does not conform to the rules
300006: Image upload failed (e.g. mediaID expired)
300022: This room number does not exist
300023: Room status Intercept (current room status does not allow this operation)
300024: The product does not exist
300025: Product review failed
300026: The number of room items is full
300027: Import failed
300028: Room name violation
300029: Host nickname violation
300030: The host microscope is illegal
300031: The cover art between live broadcasts is not compliant
300032: Live sharing map violation
300033: Add items that exceed the live room limit
300034: Host WeChat nickname length does not meet the requirements
300035: The host micros signal does not exist
300036: The host microscope is not certified by real name
300037: Shopping Live Channel cover map is not compliant
300038: Customer service is not configured in the background of small program management
300039: The host sub-signal microseal is illegal
300040: Name contains unqualified characters (with special characters)
300041: Creator microscopy is illegal
9410000: The list of live rooms is empty
9410001: Failed to get a room
9410002: Failed to get the product
9410003: Failed to get playback