(→返回数据(JSON)) |
|||
(未显示2个用户的9个中间版本) | |||
第1行: | 第1行: | ||
+ | =头条文章开放接口= | ||
+ | |||
+ | <div class="wiki_txtJ"> | ||
+ | 头条文章开放接口,需要通过用户授权 access_token 调用。 | ||
+ | |||
+ | |||
+ | 开通头条文章接口,第三方需要是政务、媒体、机构等实体,个人暂时无法接入,符合要求的微博账号,在微博开放平台上认证为开发者,然后联系自己对应的蓝V客服、或政务运营进行咨询洽谈,通过后开通接口。 | ||
+ | </div> | ||
+ | |||
+ | |||
+ | |||
==头条文章发布接口== | ==头条文章发布接口== | ||
− | = | + | |
− | + | <div class="wiki_txtJ">发布一条头条文章</div> | |
− | === | + | |
− | + | ===接口地址=== | |
− | + | ||
− | === | + | https://api.weibo.com/proxy/article/publish.json |
− | + | ||
− | + | ||
− | + | ===请求方式=== | |
+ | |||
+ | POST | ||
+ | |||
+ | |||
===请求参数=== | ===请求参数=== | ||
+ | |||
<table class="wiki_table"> | <table class="wiki_table"> | ||
<tr> | <tr> | ||
第27行: | 第43行: | ||
<td>string</td> | <td>string</td> | ||
<td>是</td> | <td>是</td> | ||
− | <td> | + | <td>正文内容,限制90000个中英文字符内,需要urlencode</td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
第34行: | 第50行: | ||
<td>是</td> | <td>是</td> | ||
<td>文章封面图片地址url</td> | <td>文章封面图片地址url</td> | ||
+ | </tr> | ||
+ | <tr> | ||
+ | <td>rip</td> | ||
+ | <td>string</td> | ||
+ | <td>是</td> | ||
+ | <td>开发者上报的操作用户真实IP,形如:211.156.0.1,请传操作用户的真实有效IP</td> | ||
</tr> | </tr> | ||
<tr> | <tr> | ||
第45行: | 第67行: | ||
<td>string</td> | <td>string</td> | ||
<td>是</td> | <td>是</td> | ||
− | <td> | + | <td>与其绑定短微博内容,限制1900个中英文字符内</td> |
</tr> | </tr> | ||
<tr> | <tr> | ||
第53行: | 第75行: | ||
<td>认证token</td> | <td>认证token</td> | ||
</tr> | </tr> | ||
− | </table> | + | </table> |
− | + | ||
− | + | <div style="margin:15px 0;"> | |
+ | 注:需要urlencode的参数采用的是 PHP 的 rawurlencode 函数,也就是空格将编码为%20 | ||
+ | </div> | ||
+ | |||
+ | |||
+ | ===返回字段说明=== | ||
− | |||
<table class="wiki_table"> | <table class="wiki_table"> | ||
<tr> | <tr> | ||
第95行: | 第121行: | ||
</tr> | </tr> | ||
</table> | </table> | ||
+ | |||
===其他说明=== | ===其他说明=== | ||
− | + | ||
− | + | 1. PC端查看文章的url地址是:https://weibo.com/ttarticle/p/show?id={id} | |
− | + | ||
− | + | 2. 手机端查看文章的url地址是:https://media.weibo.cn/article?id={id} | |
− | === | + | |
− | + | ||
+ | ===DEMO示例=== | ||
+ | |||
+ | demo地址:https://github.com/weiboeditor/open | ||
+ | |||
+ | |||
===错误码对应表=== | ===错误码对应表=== | ||
+ | |||
<table class="wiki_table"> | <table class="wiki_table"> | ||
<tr> | <tr> | ||
第135行: | 第168行: | ||
<td>文章关联微博失败</td> | <td>文章关联微博失败</td> | ||
</tr> | </tr> | ||
− | |||
</table> | </table> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | {{#a:nobtns|noheading}} | ||
+ | __NOTOC__ |
2022年11月29日 (二) 14:47的最后版本
头条文章开放接口
头条文章开放接口,需要通过用户授权 access_token 调用。
开通头条文章接口,第三方需要是政务、媒体、机构等实体,个人暂时无法接入,符合要求的微博账号,在微博开放平台上认证为开发者,然后联系自己对应的蓝V客服、或政务运营进行咨询洽谈,通过后开通接口。
头条文章发布接口
发布一条头条文章
接口地址
https://api.weibo.com/proxy/article/publish.json
请求方式
POST
请求参数
参数名称 | 类型 | 是否必需 | 描述 |
---|---|---|---|
title | string | 是 | 文章标题,限定32个中英文字符以内 |
content | string | 是 | 正文内容,限制90000个中英文字符内,需要urlencode |
cover | string | 是 | 文章封面图片地址url |
rip | string | 是 | 开发者上报的操作用户真实IP,形如:211.156.0.1,请传操作用户的真实有效IP |
summary | string | 否 | 文章导语 |
text | string | 是 | 与其绑定短微博内容,限制1900个中英文字符内 |
access_token | string | 是 | 认证token |
注:需要urlencode的参数采用的是 PHP 的 rawurlencode 函数,也就是空格将编码为%20
返回字段说明
参数名称 | 类型 | 描述 |
---|---|---|
code | string | 返回码,成功返回100000,失败返回其他 |
msg | string | 默认为空,code不为100000返回错误信息,错误描述详见错误对照表 |
data | json | 结果数据,成功时返回,失败返回空 |
|__ object_id | string | 对象id |
|__ url | string | 文章url |
|__ mid | string | 短微博对象id |
其他说明
1. PC端查看文章的url地址是:https://weibo.com/ttarticle/p/show?id={id}
2. 手机端查看文章的url地址是:https://media.weibo.cn/article?id={id}
DEMO示例
demo地址:https://github.com/weiboeditor/open
错误码对应表
错误码 | 错误信息 | 描述 |
---|---|---|
10001 | system error | 系统错误 |
10008 | param xxx invalid | 参数xxx不符合要求 |
11001 | sass check error | 发布过于频繁 |
11002 | create statuses error | 微博发送失败 |
11003 | bind error | 文章关联微博失败 |
文档更新时间: 2022-11-29