跳转到: 导航, 搜索
(响应示例)
 
(未显示2个用户的5个中间版本)
第1行: 第1行:
=头条文章发布接口=
+
=头条文章开放接口=
  
==功能==
+
<div class="wiki_txtJ">
 +
头条文章开放接口,需要通过用户授权 access_token 调用。
  
发布头条文章
 
  
 +
开通头条文章接口,第三方需要是政务、媒体、机构等实体,个人暂时无法接入,符合要求的微博账号,在微博开放平台上认证为开发者,然后联系自己对应的蓝V客服、或政务运营进行咨询洽谈,通过后开通接口。
 +
</div>
  
==调用说明==
 
  
文章服务接口是开放接口,因此需要通过微博OAuth授权认证,取得用户授权后使用,认证说明地址:
 
http://open.weibo.com/wiki/%E6%8E%88%E6%9D%83%E6%9C%BA%E5%88%B6%E8%AF%B4%E6%98%8E
 
  
==HTTP请求方式==
+
==头条文章发布接口==
  
POST
+
<div class="wiki_txtJ">发布一条头条文章</div>
  
 
+
===接口地址===
==请求URL==
+
  
 
https://api.weibo.com/proxy/article/publish.json
 
https://api.weibo.com/proxy/article/publish.json
  
  
==请求参数==
+
===请求方式===
 +
 
 +
POST
 +
 
 +
 
 +
===请求参数===
  
 
<table class="wiki_table">
 
<table class="wiki_table">
第40行: 第43行:
 
<td>string</td>
 
<td>string</td>
 
<td>是</td>
 
<td>是</td>
<td>正文内容,限制20000个中英文字符内,需要urlencode</td>
+
<td>正文内容,限制90000个中英文字符内,需要urlencode</td>
 
</tr>
 
</tr>
 
<tr>
 
<tr>
第47行: 第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>
第58行: 第67行:
 
<td>string</td>
 
<td>string</td>
 
<td>是</td>
 
<td>是</td>
<td>与其绑定短微博内容,限制120个中英文字符内</td>
+
<td>与其绑定短微博内容,限制1900个中英文字符内</td>
 
</tr>
 
</tr>
 
<tr>
 
<tr>
第68行: 第77行:
 
</table>
 
</table>
  
注:需要urlencode的参数采用的是 PHP 的rawurlencode 函数(也就是将空格编码为%20)
+
<div style="margin:15px 0;">
 +
注:需要urlencode的参数采用的是 PHP 的 rawurlencode 函数,也就是空格将编码为%20
 +
</div>
  
  
==返回数据(JSON)==
+
===返回字段说明===
  
 
<table class="wiki_table">
 
<table class="wiki_table">
第112行: 第123行:
  
  
==其他说明==
+
===其他说明===
  
1. PC端查看文章的url地址是:http://weibo.com/ttarticle/p/show?id={id}
+
1. PC端查看文章的url地址是:https://weibo.com/ttarticle/p/show?id={id}
  
2. 手机端查看文章的url地址是:http://media.weibo.cn/article?id={id}
+
2. 手机端查看文章的url地址是:https://media.weibo.cn/article?id={id}
  
  
==请求示例==
+
===DEMO示例===
  
demo地址:https://github.com/weiboeditor/open
+
demo地址:https://github.com/weiboeditor/open
  
==响应示例==
 
  
demo地址:https://github.com/weiboeditor/open
+
===错误码对应表===
 
+
==错误码对应表==
+
  
 
<table class="wiki_table">
 
<table class="wiki_table">
第161行: 第169行:
 
</tr>
 
</tr>
 
</table>
 
</table>
 +
 +
 +
  
  

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