Live/api/en

跳转到: 导航, 搜索
(Creating a Live Video)
 
(未显示1个用户的14个中间版本)
第8行: 第8行:
  
  
== 授权机制 ==
+
== Authorization Mechanism ==
  
目前微博开放平台用户身份鉴权采用的是Oauth2.0,参见 [http://open.weibo.com/wiki/%E6%8E%88%E6%9D%83%E6%9C%BA%E5%88%B6%E8%AF%B4%E6%98%8E 如何登录授权]
+
Currently we use OAuth2.0 for user authentication ,see [http://open.weibo.com/wiki/OAuth/en Oauth authorization]
  
==访问频次限制==
+
==Access Frequency Limit==
  
访问级别:<span style="color:#FF7D13;">普通接口</span>
+
Access Level:<span style="color:#FF7D13;">Common Interface</span>
  
频次限制:<span style="color:#FF7D13;"></span>
+
Frequency limit:<span style="color:#FF7D13;">Yes, 300 times per day per user</span>
  
关于频次限制,参考[http://open.weibo.com/wiki/Rate-limiting  接口访问权限说明]
 
  
==创建直播==
+
==Creating a Live Video==
  
URL : https://api.weibo.com/2/proxy/live/create [POST]
+
URL: https://api.weibo.com/2/proxy/live/create [POST]
  
说明:新建直播对象,获取直播推流地址,并同时发微博
+
Description:Create a live object, return an RTMP stream url, and post weibo at the same time
  
参数:
+
Parameter:
  
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
 
{| 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"|参数字段
+
!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"|字段必选
+
!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"|字段类型
+
!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"|字段说明
+
!width="65%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Description
{{api_args|access_token|true|string|采用OAuth授权方式为必填参数,OAuth授权后获得}}
+
{{api_args|access_token|true|string|OAuth authorization}}
{{api_args|title|true|string|直播描述}}
+
{{api_args|title|true|string|Live Description}}
{{api_args|width|true|string|直播宽度}}
+
{{api_args|width|true|string|Live Width}}
{{api_args|height|true|string|直播高度}}
+
{{api_args|height|true|string|Live Height}}
{{api_args|summary|false|string|微博文本内容,必须做URLencode,内容不超过130个汉字}}
+
{{api_args|summary|false|string|weibo text content(URLencode),does not exceed 130 Chinese characters}}
{{api_args|published|false|string|微博是否发布,0:公开发布,1:仅自己可见,默认为0}}
+
{{api_args|published|false|string|whether to publish,0:public,1:only me visible,default 0}}
{{api_args|image|false|string|封面图地址,注意封面图的宽高和直播的宽高比例要一致。需要上传图片参见本文档[http://open.weibo.com/wiki/Live/api#.E4.B8.8A.E4.BC.A0.E5.9B.BE.E7.89.87 上传图片接口]。注:建议用户不要上传分辨率太高的图片,上传图片返回的三个参数推荐用original_pic 如果原图太大推荐用bmiddle_pic,请根据情况选择合适图片}}
+
{{api_args|image|false|string|cover image url, upload picture API see [http://open.weibo.com/wiki/Live/api/en#Upload_Picture Upload Picture API]}}
{{api_args|replay|false|string|是否录制,0:不录制,1:录制,默认为1}}
+
{{api_args|replay|false|string|whether to record,0:not to record,1:record,default 1}}
 
|}
 
|}
  
返回:
+
Return:
  
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
 
{| 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"|参数字段
+
!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"|字段类型
+
!width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Type
!width="75%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
+
!width="75%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Description
{{rdes_args|id|string|直播ID}}
+
{{rdes_args|id|string|Live ID}}
{{rdes_args|rtmp_url|string|直播推流地址}}
+
{{rdes_args|rtmp_url|string|RTMP stream url}}
{{rdes_args|room_id|string|房间id}}
+
{{rdes_args|room_id|string|Room id}}
 
|}
 
|}
  
示例:
+
Example:
  
 
<pre class="brush:js">
 
<pre class="brush:js">
第66行: 第65行:
 
</pre>
 
</pre>
  
==直播推流==
+
==Live Streaming==
  
第三方根据直播创建接口返回的推流地址rtmp_url开始推流
+
You can push the stream based on the url returned by the Create Live API
  
  
==更新直播==
+
==Updating a Live Video==
  
 
URL : https://api.weibo.com/2/proxy/live/update [POST]
 
URL : https://api.weibo.com/2/proxy/live/update [POST]
  
说明:直播对象信息、状态等更新
+
Descriptioin:update the properties of a live video
  
参数:
+
Parameters:
  
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
 
{| 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"|参数字段
+
!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"|字段必选
+
!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"|字段类型
+
!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"|字段说明
+
!width="65%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Description
{{api_args|access_token|true|string|采用OAuth授权方式为必填参数,OAuth授权后获得}}
+
{{api_args|access_token|true|string|OAuth authorization}}
{{api_args|id|true|string|直播ID}}
+
{{api_args|id|true|string|Live ID}}
{{api_args|title|false|string|直播描述}}
+
{{api_args|title|false|string|Live Description}}
{{api_args|summary|false|string|微博文本内容,必须做URLencode,内容不超过130个汉字}}
+
{{api_args|summary|false|string|weibo text content(URLencode),does not exceed 130 Chinese characters}}
{{api_args|published|false|string|微博是否发布,0:公开发布,1:仅自己可见,2:不发布 默认为2}}
+
{{api_args|published|false|string|whether to publish,0:public,1:only me visible,2:not to pubish default 2}}
{{api_args|image|false|string|直播封面图地址}}
+
{{api_args|image|false|string|cover image url}}
{{api_args|stop|false|string|直播结束,0:直播中,1:直播结束,默认为0}}
+
{{api_args|stop|false|string|end live,0:live,1:live end,default 0}}
{{api_args|replay_url|false|string|直播回放地址}}
+
{{api_args|replay_url|false|string|live replay url}}
 
|}
 
|}
  
返回:
+
Return:
  
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
 
{| 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"|参数字段
+
!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"|字段类型
+
!width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Type
!width="75%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
+
!width="75%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Description
{{rdes_args|id|string|直播ID}}
+
{{rdes_args|id|string|Live ID}}
 
|}
 
|}
 
    
 
    
示例:
+
Example:
  
 
<pre class="brush:js">
 
<pre class="brush:js">
第113行: 第112行:
 
</pre>
 
</pre>
  
==删除直播==
+
==Deleting a Live Video==
  
 
URL : https://api.weibo.com/2/proxy/live/delete [POST]
 
URL : https://api.weibo.com/2/proxy/live/delete [POST]
  
说明:直播对象删除,不可逆
+
Description:delete the entire live object
  
参数:
+
Parameters:
  
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
 
{| 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"|参数字段
+
!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"|字段必选
+
!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"|字段类型
+
!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"|字段说明
+
!width="65%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Description
{{api_args|access_token|true|string|采用OAuth授权方式为必填参数,OAuth授权后获得}}
+
{{api_args|access_token|true|string|Oauth authorizatioin}}
{{api_args|id|true|string|直播ID}}
+
{{api_args|id|true|string|Live ID}}
 
|}
 
|}
  
返回:
+
Return:
  
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
 
{| 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"|参数字段
+
!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"|字段类型
+
!width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Type
!width="75%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
+
!width="75%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Description
{{rdes_args|id|string|直播ID}}
+
{{rdes_args|id|string|Live ID}}
 
|}
 
|}
  
示例:
+
Example:
  
 
<pre class="brush:js">
 
<pre class="brush:js">
第149行: 第148行:
 
</pre>
 
</pre>
  
==获取直播信息==
+
==Reading a Live Video==
  
 
URL : https://api.weibo.com/2/proxy/live/show [POST]
 
URL : https://api.weibo.com/2/proxy/live/show [POST]
  
说明:直播对象信息、互动信息等获取
+
Description:get information about the live object
  
参数:
+
parameter:
  
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
 
{| 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"|参数字段
+
!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"|字段必选
+
!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"|字段类型
+
!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"|字段说明
+
!width="65%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Description
{{api_args|access_token|true|string|采用OAuth授权方式为必填参数,OAuth授权后获得}}
+
{{api_args|access_token|true|string|Oauth authorization}}
{{api_args|id|true|string|直播ID}}
+
{{api_args|id|true|string|Live ID}}
{{api_args|detail|false|string|直播详情,0:不返回,1:返回,默认为0}}
+
{{api_args|detail|false|string|Live details,0:no return,1:return,default 0}}
 
|}
 
|}
  
返回:
+
Return:
  
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
 
{| 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"|参数字段
+
!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"|字段类型
+
!width="10%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Type
!width="75%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|字段说明
+
!width="75%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Description
{{rdes_args|id|string|直播ID}}
+
{{rdes_args|id|string|Live ID}}
{{rdes_args|uid|string|直播作者ID}}
+
{{rdes_args|uid|string|Live author ID}}
{{rdes_args|title|string|直播标题}}
+
{{rdes_args|title|string|Live Title}}
{{rdes_args|summary|string|微博文本内容}}
+
{{rdes_args|summary|string|weibo text content}}
{{rdes_args|image|string|封面图地址}}
+
{{rdes_args|image|string|cover image url}}
{{rdes_args|url|string|直播落地页}}
+
{{rdes_args|url|string|Live play url}}
{{rdes_args|status|int|直播状态}}
+
{{rdes_args|status|int|Live status}}
{{rdes_args|create_time|string|直播创建时间}}
+
{{rdes_args|create_time|string|Live Create time}}
{{rdes_args|live_views|int|直播实时在线人数,detail为1时返回}}
+
{{rdes_args|live_views|int|Live views,return when detail is 1}}
{{rdes_args|total_views|int|直播总在线人数,detail为1时返回}}
+
{{rdes_args|total_views|int|Live total views,return when detail is 1}}
{{rdes_args|total_stars|int|直播总点赞数,detail为1时返回}}
+
{{rdes_args|total_stars|int|Live total likes,return when detail is 1}}
 
|}
 
|}
 
    
 
    
示例:
+
Example:
  
 
<pre class="brush:js">
 
<pre class="brush:js">
第194行: 第193行:
 
     "id": "230912beaccf45a32ac3a36078b245ad8b5ddf",
 
     "id": "230912beaccf45a32ac3a36078b245ad8b5ddf",
 
     "uid": "2791445053",
 
     "uid": "2791445053",
     "title": "测试直播修改",
+
     "title": "test title",
     "summary": "测试直播修改简介",
+
     "summary": "test summary",
 
     "url": "http://live.weibo.com/show?id=1042097:beaccf45a32ac3a36078b245ad8b5ddf",
 
     "url": "http://live.weibo.com/show?id=1042097:beaccf45a32ac3a36078b245ad8b5ddf",
 
     "status": 3,
 
     "status": 3,
第202行: 第201行:
 
</pre>
 
</pre>
  
== 上传图片 ==
+
== Upload Picture ==
  
  
 
URL:https://api.weibo.com/statuses/upload_pic.json[POST]
 
URL:https://api.weibo.com/statuses/upload_pic.json[POST]
  
说明:上传图片接口
+
Descriptioin:upload live cover image
  
  
'''是否需要登录'''
+
parameter:
 
+
true 登录授权方式,请参见本WIKI内的 [http://open.weibo.com/wiki/%E6%8E%88%E6%9D%83%E6%9C%BA%E5%88%B6%E8%AF%B4%E6%98%8E 如何登录授权]
+
 
+
 
+
'''请求参数'''
+
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
 
{| 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"|参数字段
+
!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"|字段必选
+
!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"|字段类型
+
!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"|字段说明
+
!width="65%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|Field Description
{{api_args| access_token |true|string|采用OAuth授权方式为必填参数,OAuth授权后获得}}
+
{{api_args| access_token |true|string|Oauth Authorization}}
{{api_args| pic |true| binary |要上传的图片二进制流,仅支持JPEG、GIF、PNG格式,图片大小小于5M。}}
+
{{api_args| pic |true| binary |image binary stream,only support JPEG、GIF、PNG format,image size must less than 5M。}}
{{api_args|print_mark|false|int|是否带水印,0:不带,1:带。}}
+
{{api_args|print_mark|false|int|whether with watermark,0:no,1:yes}}
{{api_args|ori|false|int|是否支持原图,0:不支持,1:支持。}}
+
{{api_args|ori|false|int|whether to support the original image,0:do not support,1:support。}}
 
|}
 
|}
  
  
'''返回结果'''
+
//successful return
 
+
//成功返回
+
 
<pre class="brush:js">
 
<pre class="brush:js">
  
第245行: 第237行:
  
  
//失败返回
+
//failure return
 
<pre class="brush:js">
 
<pre class="brush:js">
  
第255行: 第247行:
 
</pre>
 
</pre>
  
==直播互动接口==
+
==Live Interactive API ==
请参考[http://open.weibo.com/wiki/Live/im/api 直播互动接口文档]
+
Refer to [http://open.weibo.com/wiki/Live/im/api/en Live Interactive API]
  
==错误代码==
+
==Error Code==
  
错误码
+
error code
  
 
{| border="1" cellspacing="0" cellpadding="0" width="100%" class="parameters" style="border-color:#CCCCCC;"
 
{| 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"|错误码
+
!width="15%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|error code
!width="40%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|错误msg
+
!width="40%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|error msg
!width="45%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|描述
+
!width="45%" style="text-align:left;padding-left:5px;font-weight:bolder;border:1px solid #cccccc"|description
{{rdes_args|20001|live create error|创建直播失败}}
+
{{rdes_args|20001|live create error|create live failed}}
{{rdes_args|20002|update weibo error|发微博失败}}
+
{{rdes_args|20002|update weibo error|post weibo failed}}
{{rdes_args|20003|post param loss|post参数缺失}}
+
{{rdes_args|20003|post param loss|post parameter is missing}}
{{rdes_args|20004|get param loss|get参数缺失}}
+
{{rdes_args|20004|get param loss|get parameter is missing}}
{{rdes_args|20005|live delete error|删除直播失败}}
+
{{rdes_args|20005|live delete error|delete live failed}}
{{rdes_args|20006|live update error|更新直播失败}}
+
{{rdes_args|20006|live update error|update live failed}}
{{rdes_args|20007|send message error|评论失败}}
+
{{rdes_args|20007|send message error|comment failed}}
{{rdes_args|20008|rsync message error|拉取失败}}
+
{{rdes_args|20008|rsync message error|pull failed}}
{{rdes_args|20009|live id unexist|直播ID不存在}}
+
{{rdes_args|20009|live id unexist|live ID does not exist}}
{{rdes_args|20010|weibo content more than 130 word|微博文字超过130字了}}
+
{{rdes_args|20010|weibo content more than 130 word|weibo text more than 130 words}}
{{rdes_args|20011|msg content more than 100 word,or is null|评论文字超过100字了,或者为空}}
+
{{rdes_args|20011|msg content more than 100 word,or is null|comments more than 130 words,or empty}}
{{rdes_args|20012|msg content type error|发言的文本类型错误}}
+
{{rdes_args|20012|msg content type error|comment type is wrong}}
{{rdes_args|20013|authority not allow|权限不够(appkey or uid不一致)}}
+
{{rdes_args|20013|authority not allow|authority is not allowed(appkey or uid limit )}}
{{rdes_args|20014|user not allow|uid不符合要求(用户满足:微博用户已绑定支付宝或黄V认证用户或媒体蓝v用户)}}
+
{{rdes_args|20014|user not allow|uid limit}}
 
|}
 
|}
  
示例:
+
Example:
  
 
<pre class="brush:js">
 
<pre class="brush:js">

2017年2月24日 (五) 16:42的最后版本

SINA WEIBO LIVE API


Read the following documents to help you understand how to use the Live API.


目录

Authorization Mechanism

Currently we use OAuth2.0 for user authentication ,see Oauth authorization

Access Frequency Limit

Access Level:Common Interface

Frequency limit:Yes, 300 times per day per user


Creating a Live Video

URL: https://api.weibo.com/2/proxy/live/create [POST]

Description:Create a live object, return an RTMP stream url, and post weibo at the same time

Parameter:

Parameter field Requires Field Type Field Description
access_token true string OAuth authorization
title true string Live Description
width true string Live Width
height true string Live Height
summary false string weibo text content(URLencode),does not exceed 130 Chinese characters
published false string whether to publish,0:public,1:only me visible,default 0
image false string cover image url, upload picture API see Upload Picture API
replay false string whether to record,0:not to record,1:record,default 1

Return:

Parameter field Field Type Field Description
id string Live ID
rtmp_url string RTMP stream url
room_id string Room id

Example:

{
    "id": "230916c5fc9c48670bf72b9135261865ef35cd",
    "room_id": "1042097:5617ce1cc0f822ebd37f93a0275c8660",
    "url": "rtmp://ps.live.weibo.com/***/c5fc9c48670bf72b9135261865ef35cd?auth_key=***"
}

Live Streaming

You can push the stream based on the url returned by the Create Live API


Updating a Live Video

URL : https://api.weibo.com/2/proxy/live/update [POST]

Descriptioin:update the properties of a live video

Parameters:

Parameter field Requires Field Type Field Description
access_token true string OAuth authorization
id true string Live ID
title false string Live Description
summary false string weibo text content(URLencode),does not exceed 130 Chinese characters
published false string whether to publish,0:public,1:only me visible,2:not to pubish default 2
image false string cover image url
stop false string end live,0:live,1:live end,default 0
replay_url false string live replay url

Return:

Parameter field Field Type Field Description
id string Live ID

Example:

{
    "id": "230916c5fc9c48670bf72b9135261865ef35cd"
}

Deleting a Live Video

URL : https://api.weibo.com/2/proxy/live/delete [POST]

Description:delete the entire live object

Parameters:

Parameter field Requires Field Type Field Description
access_token true string Oauth authorizatioin
id true string Live ID

Return:

Parameter field Field Type Field Description
id string Live ID

Example:

{
    "id": "230916c5fc9c48670bf72b9135261865ef35cd"
}

Reading a Live Video

URL : https://api.weibo.com/2/proxy/live/show [POST]

Description:get information about the live object

parameter:

Parameter field Requires Field Type Field Description
access_token true string Oauth authorization
id true string Live ID
detail false string Live details,0:no return,1:return,default 0

Return:

Parameter field Field Type Field Description
id string Live ID
uid string Live author ID
title string Live Title
summary string weibo text content
image string cover image url
url string Live play url
status int Live status
create_time string Live Create time
live_views int Live views,return when detail is 1
total_views int Live total views,return when detail is 1
total_stars int Live total likes,return when detail is 1

Example:

{
    "id": "230912beaccf45a32ac3a36078b245ad8b5ddf",
    "uid": "2791445053",
    "title": "test title",
    "summary": "test summary",
    "url": "http://live.weibo.com/show?id=1042097:beaccf45a32ac3a36078b245ad8b5ddf",
    "status": 3,
    "create_time": "2016-10-20 16:40:29"
}

Upload Picture

URL:https://api.weibo.com/statuses/upload_pic.json[POST]

Descriptioin:upload live cover image


parameter:

Parameter field Requires Field Type Field Description
access_token true string Oauth Authorization
pic true binary image binary stream,only support JPEG、GIF、PNG format,image size must less than 5M。
print_mark false int whether with watermark,0:no,1:yes
ori false int whether to support the original image,0:do not support,1:support。


//successful return


{
    "pic_id": "946308c5jw1dv288whtylj",
    "thumbnail_pic": "http://ww3.sinaimg.cn/thumbnail/946308c5jw1dv288whtylj.jpg",
    "bmiddle_pic": "http://ww3.sinaimg.cn/bmiddle/946308c5jw1dv288whtylj.jpg",
    "original_pic": "http://ww3.sinaimg.cn/large/946308c5jw1dv288whtylj.jpg"
}
 


//failure return


{
    "request": "/2/statuses/upload_pic.json",
    "error_code": "201XX",
    "error": "error message."
}

Live Interactive API

Refer to Live Interactive API

Error Code

error code

error code error msg description
20001 live create error create live failed
20002 update weibo error post weibo failed
20003 post param loss post parameter is missing
20004 get param loss get parameter is missing
20005 live delete error delete live failed
20006 live update error update live failed
20007 send message error comment failed
20008 rsync message error pull failed
20009 live id unexist live ID does not exist
20010 weibo content more than 130 word weibo text more than 130 words
20011 msg content more than 100 word,or is null comments more than 130 words,or empty
20012 msg content type error comment type is wrong
20013 authority not allow authority is not allowed(appkey or uid limit )
20014 user not allow uid limit

Example:

{
  request :
  error_code :
  error :
}
文档更新时间: 2017-02-24