微博开放平台
微连接
移动应用
网站接入
电商服务商
电商商家
数据服务
数据服务
合作伙伴
微博支付
轻应用
粉丝服务
文档
推广
我的应用
登录
weibo
开发文档
首页
平台政策与指引
概述
平台公约
新手指南
开发者协议
应用运营管理规范
微连接分级管理办法
应用审核产品指南
应用安全开发注意事项
平台应用设计规范
微服务接入指南
微博登录接入
用微博帐号登录
授权机制
移动应用接入
移动应用介绍
移动应用SSO授权
微博Deep Link
媒体接入平台
头条文章开放接口
视频上传开放接口
电商接入平台
电商服务商接入
电商商家端接入
电商平台能力接口
粉丝服务平台
粉丝服务平台
新手接入指南
微信开发者迁移指南
接收消息
发送消息
自定义菜单
用户管理
生成带参数的二维码
Fans Service Platform
商业接口
商业数据接入指南
订阅服务手册(中文版)
订阅服务手册(英文版)
商业接口-REST API
商业数据常见问题
网站接入
网站接入介绍
微博API
微博API
接口访问频次权限
资源下载
SDK
微博标识下载
常见问题
联系我们
工具箱
链入页面
链出更改
特殊页面
查看源代码
跳转到:
导航
,
搜索
根据下列原因,你没有权限编辑本页:
您刚才请求的操作只有这个用户组中的用户才能使用:
用户
您可以查看并复制此页面的源代码:
== Overview == One of the cooperation mode between weibo and the third-party that access to weibo is server-side synchronization.This mode means doing message synchronization between live interactive system of weibo and interactive system of the third-party to implement message sharing. Send message interface and pull message interface(active pull and callback pull)can synchronize third-party messages to weibo. == Post Comments == '''Description''' Post comment of the users to weibo live-im system. '''URL''' https://api.weibo.com/2/liveim/message/sync.json [POST] '''Support Formats''' JSON '''Authorization''' Required. More details of login authorization, Please refer to this WIKI[http://open.weibo.com/wiki/OAuth/en How to login to authorization] '''Request parameter''' {| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;" |- !width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Parameter field !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Requires !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"| Field Type !width="65%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field description {{api_args| access_token|true|string|Required parameters when using OAuth authorization mode,obtained after OAuth authorization}} {{api_args|room_id|true|string|room id}} {{api_args|ts|true|long|Timestamp(The number of milliseconds from 1970-01-01 00:00:00),cannot delay more than 2min}} {{api_args|msg_type|true|int|message types, see [http://open.weibo.com/wiki/Live/im/api/en#Message_Type message types]}} {{api_args|content|true|string|Message content}} {{api_args|uid|true|long|sender ID}} {{api_args|nickname|true|string|Sender nickname}} {{api_args|avatar|true|string|sender avatar url}} {{api_args|sign|true|string|The result of signing all the parameters other than sign ,See [http://open.weibo.com/wiki/Live/im/api/en#Signature_Algorithm signature algorithm]}} {{api_args|extension|false|string|message extension field [http://open.weibo.com/wiki/Live/im/api/en#Data_Structure see] (json object format, the default is empty json object) }} {{api_args|offset|false|long|the time offset between sending message and the start of the live,unit:ms.If not pass, or pass the negative, do 0 process,indicating that the current message is not displayed when playing back.}} |} '''Return result''' //Successful return <pre class="brush:js"> { "error_code":0, //0 indicates success,while others mean failed. Need to see the error message "error_msg":"" } </pre> //Failed to return <pre class="brush:js"> { "error_code": 91XX, "error_msg": "xxxxxxxxx" } </pre> == Receive Comments-Pull Mode == '''Description''' This interface allows the third-party pull room messages from weibo live interactive system.After the third-party initiates the request,the interface will push the latest message in the room continuously as long as the connection is not broken.If the connection is disconnected accidentally,the message will continue to be pushed from the last disconnected position as long as the cumulative number of messages before the reconnection does not exceed the agreed threshold. '''URL''' https://api.weibo.com/2/liveim/message/pull.stream [GET] '''Support Formats''' JSON '''Authorization''' Required. More details of login authorization, Please refer to this WIKI [http://open.weibo.com/wiki/OAuth/en How to log in to authorization] '''Request parameter''' {| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;" |- !width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Parameter field !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Requires !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Type !width="65%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field description {{api_args| access_token|true|string|Required parameters when using OAuth authorization mode,obtained after OAuth authorization}} {{api_args|room_id|true|string|room id}} |} '''Return Result''' The return message is pushed in JSON mode, and the data structure is pushed as follows. Each message is a separate JSON-OBJECT. //Successful return <pre class="brush:js"> { "error_code":0, //0 indicates success,while others mean failed. Need to see the error message "error_msg":"", } { // message body. See Annex [Data structure / message body] } { // message body. } ... </pre> //Failed to return <pre class="brush:js"> { "error_code": 91XX, "error_msg": "xxxxxxxxx" } </pre> about error return values and error codes, see[http://open.weibo.com/wiki/Live/im/api/en#Error_code_definition Error Code Definitions] == Receive Comments-Callback Mode == '''Description''' If the third-party uses HTTP Callback mode to accept weibo messages,the third-party needs to provide an interface similar to [send message interface]. Requires the same parameters and return values as that interface. '''URL''' customize by the third-party '''Support format''' JSON '''HTTP request mode''' POST '''Authorization''' Required. More details of login authorization, Please refer to this WIKI[http://open.weibo.com/wiki/OAuth/en How to log in to authorization] '''Request parameter''' {| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;" |- !width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Parameter field !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Requires !width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Type !width="65%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field description {{api_args| source |true|string|AppKey applied when applying for application,When calling an interface, it represents the unique identity of the application(This parameter is not required when using OAuth authorization mode)}} {{api_args|room_id|true|string|room id}} {{api_args|ts|true|long|Timestamp(The number of milliseconds from 1970-01-01 00:00:00)}} {{api_args|msg_type|true|int|Message Type 1 - Comment Message 2 - Praise message}} {{api_args|content|true|string|Message content}} {{api_args|uid|true|long|sender ID}} {{api_args|nickname|true|string|sender nickname}} {{api_args|avatar|true|string|sender avatar url}} {{api_args|sign|true|string|The result of signing all the parameters other than sign ,See[http://open.weibo.com/wiki/Live/im/api/en#Signature_Algorithm signature algorithm]}} {{api_args|extension|false|string|message extension field[http://open.weibo.com/wiki/Live/im/api/en#Data_Structure see](json object format, the default is empty json object)}} {{api_args|offset|false|long|the time offset between sending message and the start of the live,unit:ms.If not pass, or pass the negative, do 0 process,indicating that the current message is not displayed when playing back.}} |} Return result //Successful return <pre class="brush:js"> { "error_code":0, //0 indicates success,while others mean failed. Need to see the error message "error_msg":"" } </pre> //Failed to return <pre class="brush:js"> { "error_code": 91XX, "error_msg": "xxxxxxxxx" } </pre> == Signature Algorithm== '''Input:''' - the list of key-value pairs - appsecret used to signature '''Output:''' Signature Result String '''Algorithm:''' - Each of the key-value pair composes a string follows key=value format,each string is sorted by the dictionary order of the key(key is not the same),then a semiangle sign "&" is used to form a string. - The string is encoded in UTF-8 to get a byte sequence input,the secret string is encoded by UTF-8 to generate a byte sequence as the key,the byte sequence of the hash value is calculated in the form of hmac-md5,the hash-value byte sequence uses URL-safe-Base64 encoding,then take the 6th to 16th characters as the result output. '''Algorithm Example:''' Assume that the input is: kv-pair: {"a":"1", "c":"jerry", "b":"tom"} appsecret: 123456 the concatenated string is: a=1&b=tom&c=jerry hmac-md5("a=1&b=tom&c=jerry",123456) byte array output:[-117, -27, -78, -5, 73, 68, -64, -50, 4, 21, 16, -55, -55, -39, -31, -15] converted to URL-safe base64 string:i-Wy-0lEwM4EFRDJydnh8Q== take the 6th to 16th characters(initial bit is 0), contains the 6th, does not contain the 16th, a total of 10 bits:lEwM4EFRDJ '''Signature results:''' lEwM4EFRDJ == Data Structure == '''Message Body''' <pre class="brush:js"> { "room_id":string, // room id "room_sys_id": uint64, // room id (internal) "msg_type":int, // Message type, see "Message Type Description" "mid":long, "sender_info":{ // user information of the sender, see "User Information" }, "content":string, // message content "extension":string, // The extended field of the message "offset": long, // the offset of message time from the video start time,unit:ms "created_at":long // Timestamp,the number of milliseconds from 1970-01-01 0:00:00 GMT //If there are other fields, these fields continue here,related fields See "Additional fields for each message type" } </pre> '''extension''' For the message types 1 to 14, each kind of message will have some unique fields used to represent the business, these fields will appear in the sys field inside of the extension, the structure is as follows: <pre class="brush:js"> extension = { "sys": { // The fields that appear here are listed in "unique additional fields to each type".If the extra field list is empty, the "sys" field may not exist }, // "Other transparent fields" } </pre> unique additional fields to each type <pre class="brush:js"> chat message,msg_type=1 "msg_behavior":uint32 //the display behavior of message 0: Default 1. Barrage praise message,msg_type=2 "praises_count":int // Current total number of praise "inc_praises":long // the number of times that users point like banned,msg_type=4 "shut_info":{ // the users be banned "shutted_until":uint32 //the remaining time of the end of prohibition,unit:s "members":[ //User list that be banned { "uid":uint64 //the UID of the user that be banned "user_system":string //the system that the banned user belongs to } ] } room change,msg_type=11 "live_status":int // Indicates the status of the live broadcast "room_info": { // Room information body, see "room information" } join room and exit room,msg_type=12 "exit_or_enter_room":int // 0:exit 1:join "room_info": { // Room information body, see "room information" } add and delete administrator,msg_type=14 "admin_info":{ // information of users that be added or deleted "uid":uint64 //UID of the administrator "user_system":string //the system that the administrator belongs to "type":int //Operation Type 1:Add 2:Delete } </pre> == Live Interface == Please refer to[http://open.weibo.com/wiki/Live/api/en live interface documentation] == Message Type == 1 - chat message 2 - praise message 3 - light the anchor message 4 - banned message 6 - announcement message 7 - share live messages 8 - focus on the anchor message 11 -live change message (any change in room status will be pushed) 12 - join / exit room message 13 - reward message 14 - administrator change message 100 - customize message type == Error code definition == <table class="wiki_table"> <tr> <th style="width: 10%">error code</th> <th>error description</th> </tr> <tr> <td>9101</td> <td>authentication failed</td> </tr> <tr> <td>9102</td> <td>internal error</td> </tr> <tr> <td>9103</td> <td>data format error</td> </tr> <tr> <td>9104</td> <td>the message contains spam</td> </tr> <tr> <td>9105</td> <td>already exists</td> </tr> <tr> <td>9106</td> <td>data is not legal.the point that unlike 9103 : 9103 is the data format error, such as a int parameter should be passed but passed a string can not be resolved into int. And the current error code indicates that the data format itself is not a problem, but is an illegal data, such as ID corresponding entity does not exist.</td> </tr> <tr> <td>9107</td> <td>room is not allowed to speak</td> </tr> <tr> <td>9108</td> <td>user does not exist</td> </tr> <tr> <td>9109</td> <td>room does not exist</td> </tr> <tr> <td>9110</td> <td>token parse error</td> </tr> <tr> <td>9111</td> <td>room status is not correct</td> </tr> <tr> <td>9112</td> <td>the user is banned</td> </tr> <tr> <td>9113</td> <td>the current operation is not allowed</td> </tr> <tr> <td>1019</td> <td>the current operation is not supported</td> </tr> </table>
该页面使用的模板:
模板:Api args
(
查看源代码
)
返回到
Live/im/api/en
。
反馈
分享
顶部