(以“=蓝V认证媒体内容接入服务= <div class="wiki_txtJ"> 为微博认证的机构、媒体蓝V账号,提供内容接入服务。 </div> ==基础能力== <...”为内容创建页面) |
|||
(未显示1个用户的10个中间版本) | |||
第33行: | 第33行: | ||
<div class="wiki_title_withline">内容接入服务获取授权接口</div> | <div class="wiki_title_withline">内容接入服务获取授权接口</div> | ||
+ | |||
+ | <div style="margin:15px 0;"> | ||
+ | 获取机构、媒体蓝V账号下内容接入服务应用的授权 token | ||
+ | </div> | ||
+ | |||
+ | |||
+ | <div class="code_type">接口 URL</div> | ||
+ | <pre class="brush:html"> | ||
+ | https://api.weibo.com/oauth2/vp/authorize | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | <div class="code_type">HTTP 请求方式</div> | ||
+ | <div style="margin:15px 0;"> | ||
+ | GET | ||
+ | </div> | ||
+ | |||
+ | |||
+ | <div class="code_type">请求参数</div> | ||
+ | <div style="margin:15px 0;"> | ||
+ | {|width="100%" border="0" cellspacing="0" cellpadding="0" class="wiki_table" | ||
+ | <html><colgroup></colgroup></html> | ||
+ | !width="20%"|参数名称 | ||
+ | !width="10%"|是否必填 | ||
+ | !width="10%"|类型 | ||
+ | !width="60%"|说明描述 | ||
+ | |- | ||
+ | |client_id | ||
+ | |true | ||
+ | |string | ||
+ | |机构、媒体蓝V账号在微博开放平台申请的【内容接入服务 APPKEY】。 | ||
+ | |- | ||
+ | |timestamp | ||
+ | |true | ||
+ | |string | ||
+ | |当前时间戳(毫秒)。 | ||
+ | |- | ||
+ | |nonce | ||
+ | |true | ||
+ | |string | ||
+ | |随机字符串。 | ||
+ | |- | ||
+ | |sign | ||
+ | |true | ||
+ | |string | ||
+ | |签名:md5(client_id&developer_uid×tamp&nonce&secret)。 | ||
+ | |} | ||
+ | |||
+ | 注:其中client_id为机构、媒体蓝V账号在微博开放平台申请的【内容接入服务 APPKEY】,developer_uid为开发者即机构、媒体蓝V账号的微博UID。 | ||
+ | </div> | ||
+ | |||
+ | |||
+ | <div class="code_type">返回结果 JSON 示例</div> | ||
+ | <pre class="brush:js"> | ||
+ | { | ||
+ | "client_id": "772915", | ||
+ | "uid": 1404376560, | ||
+ | "access_token": "2.00lnqNgH0YhE_q6594efd4abyzYM7E", | ||
+ | "issued_at": 1655101652, | ||
+ | "expires_in": 2637148 | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | <div class="code_type">无有效授权关系时,返回结果 JSON 示例</div> | ||
+ | <pre class="brush:js"> | ||
+ | { | ||
+ | "error": "no access_token", | ||
+ | "error_code": 21301 | ||
+ | } | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | <div class="code_type">返回字段说明</div> | ||
+ | <div style="margin:15px 0;"> | ||
+ | {|width="100%" border="0" cellspacing="0" cellpadding="0" class="wiki_table" | ||
+ | <html><colgroup></colgroup></html> | ||
+ | !width="20%"|返回值字段 | ||
+ | !width="20%"|类型 | ||
+ | !width="60%"|字段说明描述 | ||
+ | |- | ||
+ | |client_id | ||
+ | |string | ||
+ | |机构、媒体蓝V账号在微博开放平台申请的【内容接入服务 APPKEY】。 | ||
+ | |- | ||
+ | |uid | ||
+ | |string | ||
+ | |授权用户的微博 UID,实际上就是机构、媒体蓝V账号自己的UID。 | ||
+ | |- | ||
+ | |access_token | ||
+ | |string | ||
+ | |授权的【内容接入服务 access_token】,用于调用内容接入服务接口。 | ||
+ | |- | ||
+ | |issued_at | ||
+ | |string | ||
+ | |access_token 的生成的时间戳。 | ||
+ | |- | ||
+ | |expires_in | ||
+ | |string | ||
+ | |access_token 的生命周期,单位是秒数。 | ||
+ | |} | ||
+ | </div> | ||
+ | |||
+ | |||
+ | |||
+ | ==内容发布能力== | ||
+ | |||
+ | <div class="wiki_txtJ"> | ||
+ | 机构、媒体蓝V账号,可以通过内容接入服务,调用下面的接口,将内容发布到微博。 | ||
+ | </div> | ||
+ | |||
+ | |||
+ | |||
+ | <div class="wiki_title_withline">内容发布接口</div> | ||
+ | |||
+ | <div style="margin:15px 0;"> | ||
+ | <table class="wiki_table" border="0" cellspacing="0" cellpadding="0" style="width:100%"> | ||
+ | <tr> | ||
+ | <th class="wiki_table_thfirst" style="width:180px">接口</th> | ||
+ | <th>说明</th> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td class="wiki_table_tdfirst">[[2/statuses/update|statuses/update]]</td> | ||
+ | <td>发布微博</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td class="wiki_table_tdfirst">[[2/statuses/upload_url_text|statuses/upload_url_text]]</td> | ||
+ | <td>发布图文微博</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td class="wiki_table_tdfirst">[[2/statuses/upload_pic|statuses/upload_pic]]</td> | ||
+ | <td>上传图片到素材库</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td class="wiki_table_tdfirst">[[2/statuses/repost|statuses/repost]]</td> | ||
+ | <td>转发一条微博</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td class="wiki_table_tdfirst">[[2/statuses/destroy|statuses/destroy]]</td> | ||
+ | <td>删除一条我发的微博</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td class="wiki_table_tdfirst">[[2/comments/create|comments/create]]</td> | ||
+ | <td>评论一条微博</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td class="wiki_table_tdfirst">[[2/comments/reply|comments/reply]]</td> | ||
+ | <td>回复一条我收到的评论</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td class="wiki_table_tdfirst">[[2/comments/destroy|comments/destroy]]</td> | ||
+ | <td>删除一条评论</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td class="wiki_table_tdfirst">[[toutiao/api|头条文章发布接口]]</td> | ||
+ | <td>发布头条文章到微博</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td class="wiki_table_tdfirst">[[video/api|视频上传发布接口]]</td> | ||
+ | <td>上传视频并发布视频微博</td> | ||
+ | </tr> | ||
+ | </table> | ||
+ | </div> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | {{#a:nobtns|noheading}} | ||
+ | __NOTOC__ |
2024年3月29日 (五) 15:04的最后版本
蓝V认证媒体内容接入服务
为微博认证的机构、媒体蓝V账号,提供内容接入服务。
基础能力
微博认证的蓝V账号对接内容接入服务时,授权获取 access_token 的能力。
授权登录,获取 access_token
内容接入服务的 access_token 是机构、媒体蓝V账号调用接口的唯一校验凭证,机构、媒体蓝V账号在内容接入服务中,调用各接口时都需使用这个 access_token,开发者需要在服务端妥善保存好 access_token,不应将其保存到应用前端。
内容接入服务的 access_token 和网页应用、移动应用获得的 access_token 有所不同,内容接入服务获得的 access_token 有效期为2个小时,需定时刷新,重复获取将导致上次获取的 access_token 失效。
机构、媒体蓝V账号,在内容接入服务中,可以通过内容接入服务的 appkey 和 appsecret 直接调用下面的接口,来获取内容接入服务的 access_token。
同时,内容接入服务的 appkey,也只能通过下面的接口,获取到机构、媒体蓝V账号自己的 access_token,不能通过网页应用、移动应用的授权接口获取其他微博用户的授权 access_token。即内容接入服务的 appkey,不能调用 oauth2/authorize、oauth2/access_token 接口。
内容接入服务获取授权接口
获取机构、媒体蓝V账号下内容接入服务应用的授权 token
接口 URL
https://api.weibo.com/oauth2/vp/authorize
HTTP 请求方式
GET
请求参数
参数名称 | 是否必填 | 类型 | 说明描述 |
---|---|---|---|
client_id | true | string | 机构、媒体蓝V账号在微博开放平台申请的【内容接入服务 APPKEY】。 |
timestamp | true | string | 当前时间戳(毫秒)。 |
nonce | true | string | 随机字符串。 |
sign | true | string | 签名:md5(client_id&developer_uid×tamp&nonce&secret)。 |
注:其中client_id为机构、媒体蓝V账号在微博开放平台申请的【内容接入服务 APPKEY】,developer_uid为开发者即机构、媒体蓝V账号的微博UID。
返回结果 JSON 示例
{ "client_id": "772915", "uid": 1404376560, "access_token": "2.00lnqNgH0YhE_q6594efd4abyzYM7E", "issued_at": 1655101652, "expires_in": 2637148 }
无有效授权关系时,返回结果 JSON 示例
{ "error": "no access_token", "error_code": 21301 }
返回字段说明
返回值字段 | 类型 | 字段说明描述 |
---|---|---|
client_id | string | 机构、媒体蓝V账号在微博开放平台申请的【内容接入服务 APPKEY】。 |
uid | string | 授权用户的微博 UID,实际上就是机构、媒体蓝V账号自己的UID。 |
access_token | string | 授权的【内容接入服务 access_token】,用于调用内容接入服务接口。 |
issued_at | string | access_token 的生成的时间戳。 |
expires_in | string | access_token 的生命周期,单位是秒数。 |
内容发布能力
机构、媒体蓝V账号,可以通过内容接入服务,调用下面的接口,将内容发布到微博。
内容发布接口
接口 | 说明 |
---|---|
statuses/update | 发布微博 |
statuses/upload_url_text | 发布图文微博 |
statuses/upload_pic | 上传图片到素材库 |
statuses/repost | 转发一条微博 |
statuses/destroy | 删除一条我发的微博 |
comments/create | 评论一条微博 |
comments/reply | 回复一条我收到的评论 |
comments/destroy | 删除一条评论 |
头条文章发布接口 | 发布头条文章到微博 |
视频上传发布接口 | 上传视频并发布视频微博 |
文档更新时间: 2024-03-29