Live/api/en

Jump to: navigation, search

SINA WEIBO LIVE API


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


Contents

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 :
}
文档更新时间: 24 February 2017