豆瓣 API 参考手册
豆邮
豆邮相关的API必须先进行API认证授权,关于API认证授权的信息请参阅API 授权说明
获取收件箱列表
GET http://api.douban.com/doumail/inbox
例如
GET http://api.douban.com/doumail/inbox?max-results=1
返回格式
</feed>ml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:db="http://www.douban.com/xmlns/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/">
<title>胖胖的大头鱼的收件箱</title>
<author>
<link href="http://api.douban.com/people/1057620" rel="self"/>
<link href="http://www.douban.com/people/aka/" rel="alternate"/>
<link href="http://t.douban.com/icon/u1057620-20.jpg" rel="icon"/>
<name>胖胖的大头鱼</name>
<uri>http://api.douban.com/people/1057620</uri>
</author>
<opensearch:startIndex>1</opensearch:startIndex>
<entry>
<id>http://api.douban.com/doumail/20152009</id>
<title>关于活动2¥看经典电影,免费游世界最大电影博物馆!:(周末+元旦)假日期间,电影放映单</title>
<author>
<link href="http://api.douban.com/people/1169642" rel="self"/>
<link href="http://www.douban.com/people/katelan/" rel="alternate"/>
<link href="http://t.douban.com/icon/u1169642-76.jpg" rel="icon"/>
<name>卡特兰 :-)</name>
<uri>http://api.douban.com/people/1169642</uri>
</author>
<published>2008-12-26T16:16:10+08:00</published>
<link href="http://api.douban.com/doumail/20152009" rel="self"/>
<link href="http://www.douban.com/doumail/20152009/" rel="alternate"/>
<db:attribute name="unread">true</db:attribute>
</entry>
<opensearch:itemsPerPage>1</opensearch:itemsPerPage>
</feed>
获取收件箱未读邮件列表
GET http://api.douban.com/doumail/inbox/unread
例如
GET http://api.douban.com/doumail/inbox/unread?max-results=1
返回格式
<?xml versio"1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:db="http://www.douban.com/xmlns/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/">
<title>胖胖的大头鱼的未读邮件</title>
<author>
<link href="http://api.douban.com/people/1057620" rel="self"/>
<link href="http://www.douban.com/people/aka/" rel="alternate"/>
<link href="http://t.douban.com/icon/u1057620-20.jpg" rel="icon"/>
<name>胖胖的大头鱼</name>
<uri>http://api.douban.com/people/1057620</uri>
</author>
<opensearch:startIndex>1</opensearch:startIndex>
<entry>
<id>http://api.douban.com/doumail/20152801</id>
<title>test</title>
<author>
<link href="http://api.douban.com/people/1057620" rel="self"/>
<link href="http://www.douban.com/people/aka/" rel="alternate"/>
<link href="http://t.douban.com/icon/u1057620-20.jpg" rel="icon"/>
<name>胖胖的大头鱼</name>
<uri>http://api.douban.com/people/1057620</uri>
</author>
<published>2008-12-26T16:23:01+08:00</published>
<link href="http://api.douban.com/doumail/20152801" rel="self"/>
<link href="http://www.douban.com/doumail/20152801/" rel="alternate"/>
<db:attribute name="unread">true</db:attribute>
</entry>
<opensearch:totalResults>1</opensearch:totalResults>
<opensearch:itemsPerPage>1</opensearch:itemsPerPage>
</feed>
获取发件箱列表
GET http://api.douban.com/doumail/outbox
例如
GET http://api.douban.com/doumail/outbox?max-results=1
返回格式
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:db="http://www.douban.com/xmlns/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/">
<title>胖胖的大头鱼的发件箱</title>
<author>
<link href="http://api.douban.com/people/1057620" rel="self"/>
<link href="http://www.douban.com/people/aka/" rel="alternate"/>
<link href="http://t.douban.com/icon/u1057620-20.jpg" rel="icon"/>
<name>胖胖的大头鱼</name>
<uri>http://api.douban.com/people/1057620</uri>
</author>
<opensearch:startIndex>1</opensearch:startIndex>
<entry>
<id>http://api.douban.com/doumail/20152801</id>
<title>test</title>
<published>2008-12-26T16:23:01+08:00</published>
<link href="http://api.douban.com/doumail/20152801" rel="self"/>
<link href="http://www.douban.com/doumail/20152801/" rel="alternate"/>
<db:entity name="receiver">
<link href="http://api.douban.com/people/1057620" rel="self"/>
<link href="http://www.douban.com/people/aka/" rel="alternate"/>
<link href="http://t.douban.com/icon/u1057620-20.jpg" rel="icon"/>
<name>胖胖的大头鱼</name>
<uri>http://api.douban.com/people/1057620</uri>
</db:entity>
</entry>
<opensearch:itemsPerPage>1</opensearch:itemsPerPage>
</feed>
获取一封豆邮
GET http://api.douban.com/doumail/{doumailID}
参数
| 参数 | 意义 | 备注 |
| keep-unread | 当用户是收件人且邮件未读时,改参数指明是否保持未读状态。默认为false |
例如
GET http://api.douban.com/doumail/20152801
返回格式
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:db="http://www.douban.com/xmlns/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/">
<id>http://api.douban.com/doumail/20152801</id>
<title>test</title>
<author>
<link href="http://api.douban.com/people/1057620" rel="self"/>
<link href="http://www.douban.com/people/aka/" rel="alternate"/>
<link href="http://t.douban.com/icon/u1057620-20.jpg" rel="icon"/>
<name>胖胖的大头鱼</name>
<uri>http://api.douban.com/people/1057620</uri>
</author>
<published>2008-12-26T16:23:01+08:00</published>
<link href="http://api.douban.com/doumail/20152801" rel="self"/>
<link href="http://www.douban.com/doumail/20152801/" rel="alternate"/>
<content>test</content>
<db:attribute name="unread">false</db:attribute>
<db:entity name="receiver">
<link href="http://api.douban.com/people/1057620" rel="self"/>
<link href="http://www.douban.com/people/aka/" rel="alternate"/>
<link href="http://t.douban.com/icon/u1057620-20.jpg" rel="icon"/>
<name>胖胖的大头鱼</name>
<uri>http://api.douban.com/people/1057620</uri>
</db:entity>
</entry>
发豆邮
POST http://api.douban.com/doumails
请求为一个Entry
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:db="http://www.douban.com/xmlns/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/">
<db:entity name="receiver">
<uri>http://api.douban.com/people/aka</uri>
</db:entity>
<content>test</content>
<title>test</title>
<db:attribute name="captcha_token">1234567890</db:attribute><!--当要求验证码时提供 -->
<db:attribute name="captcha_string">hello</db:attribute><!--当要求验证码时提供 -->
</entry>
成功返回
201 CREATED
当发送豆邮请求过于频繁时,系统可能要求验证码,此时请求返回
403 FORBIDDEN
captcha_token={captcha_id}&captcha_url={captcha_url}
其中captcha_url为验证码图片的url地址,第三方应用需要引导用户输入图片中的文本。再次发送豆邮时,请求需携带captcha_token和captcha_string参数,其中captcha_string为验证码图片对应的文本。
标记豆邮已读
PUT http://api.douban.com/doumail/{doumailID}
请求为一个Entry
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom" xmlns:db="http://www.douban.com/xmlns/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/">
<db:attribute name="unread">false</db:attribute>
</entry>
成功返回
201 CREATED
删除豆邮
DELETE http://api.douban.com/doumail/{doumailID}
例如
DELETE http://api.douban.com/doumail/3673470
成功返回
200 OK
批量标记豆邮已读
PUT http://api.douban.com/doumail/
请求为一个Feed
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:db="http://www.douban.com/xmlns/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/">
<entry>
<id>http://api.douban.com/doumail/18719168</id>
<db:attribute name="unread">false</db:attribute>
</entry>
<entry>
<id>http://api.douban.com/doumail/18646229</id>
<db:attribute name="unread">false</db:attribute>
</entry>
</feed>
成功返回
202 ACCEPT
批量删除豆邮
POST http://api.douban.com/doumail/delete
请求为一个Feed
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:db="http://www.douban.com/xmlns/" xmlns:gd="http://schemas.google.com/g/2005" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/">
<entry>
<id>http://api.douban.com/doumail/18719168</id>
</entry>
<entry>
<id>http://api.douban.com/doumail/18646229</id>
</entry>
</feed>
成功返回
200 OK
> 回到参考手册目录