raindrop-api
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRaindrop.io API Skill
Raindrop.io API 使用指南
This skill enables interaction with the Raindrop.io bookmarks service through its REST API. Use and for direct REST calls.
curljqOfficial API documentation: https://developer.raindrop.io/
本技能支持通过REST API与Raindrop.io书签服务进行交互,使用和直接调用REST接口。
curljq官方API文档:https://developer.raindrop.io/
Authentication
身份验证
Token Resolution
Token 获取优先级
Resolve the API token in this order:
- Check environment variable
RAINDROP_TOKEN - Check if the user has provided a token in the conversation context
- If neither is available, use AskUserQuestion to request the token from the user
To verify a token exists in the environment:
bash
[ -n "$RAINDROP_TOKEN" ] && echo "Token available" || echo "Token not set"Quick setup: For personal use or development, generate a test token at https://app.raindrop.io/settings/integrations — open your app and copy the "Test token". Test tokens do not expire.
For full OAuth2 flow details, see the Authentication section below.
按以下顺序获取API Token:
- 检查环境变量
RAINDROP_TOKEN - 检查对话上下文是否有用户提供的Token
- 若以上都没有,使用AskUserQuestion向用户请求Token
验证环境中是否存在Token:
bash
[ -n "$RAINDROP_TOKEN" ] && echo "Token available" || echo "Token not set"快速设置:个人使用或开发时,可在https://app.raindrop.io/settings/integrations生成测试Token——打开应用并复制「Test token」。测试Token不会过期。
完整OAuth2流程详情,请查看下方的身份验证:OAuth2流程章节。
Making Authenticated Requests
发起已认证请求
All requests require the Authorization header with Bearer token:
bash
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/ENDPOINT"For POST/PUT requests with JSON body:
bash
curl -s -X POST \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"key": "value"}' \
"https://api.raindrop.io/rest/v1/ENDPOINT"所有请求都需要携带包含Bearer Token的Authorization头:
bash
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/ENDPOINT"对于带JSON请求体的POST/PUT请求:
bash
curl -s -X POST \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"key": "value"}' \
"https://api.raindrop.io/rest/v1/ENDPOINT"Verifying Authentication
验证身份
Test the token by retrieving the current user:
bash
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/user" | jq '.user.fullName'通过获取当前用户信息来测试Token有效性:
bash
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/user" | jq '.user.fullName'Base URL and Conventions
基础URL与约定
- Base URL:
https://api.raindrop.io/rest/v1/ - Data Format: JSON for all request/response bodies
- Timestamps: ISO 8601 format
- Rate Limit: 120 requests per minute per authenticated user
- CORS: Supported for browser-based apps
- 基础URL:
https://api.raindrop.io/rest/v1/ - 数据格式:所有请求/响应体均为JSON格式
- 时间戳:ISO 8601格式
- 请求限制:每个已认证用户每分钟最多120次请求
- CORS:支持基于浏览器的应用
Confirmation Requirement
确认要求
Before executing any destructive action (DELETE, bulk update, move to trash), always ask the user for confirmation using AskUserQuestion. A single confirmation suffices for a logical group of related actions.
Destructive actions include:
- Deleting raindrops, collections, or tags
- Bulk updating or moving raindrops
- Merging or removing tags
- Removing collaborators from shared collections
- Clearing trash
Read-only operations (GET requests) do not require confirmation.
在执行任何破坏性操作(DELETE、批量更新、移至回收站)前,必须使用AskUserQuestion征得用户确认。 一组相关的逻辑操作只需一次确认即可。
破坏性操作包括:
- 删除雨滴、集合或标签
- 批量更新或移动雨滴
- 合并或移除标签
- 从共享集合中移除协作者
- 清空回收站
只读操作(GET请求)无需确认。
Endpoints Reference
端点参考
Raindrops (Bookmarks)
雨滴(书签)
Single Raindrop Operations
单个雨滴操作
| Operation | Method | Endpoint |
|---|---|---|
| Get raindrop | GET | |
| Create raindrop | POST | |
| Update raindrop | PUT | |
| Remove raindrop | DELETE | |
| Upload file | PUT | |
| Upload cover | PUT | |
| Get permanent copy | GET | |
| Suggest (new URL) | POST | |
| Suggest (existing) | GET | |
Raindrop creation/update fields:
- (string, required for creation) - Bookmark URL
link - (string) - Bookmark title
title - (string) - Short description
excerpt - (string) - User notes (supports Markdown)
note - (array of strings) - Tag names
tags - (object) -
collection{"$id": collectionId} - (string) -
type,link,article,image,video,documentaudio - (boolean) - Mark as favourite
important - (number) - Sort order (ascending)
order - (array) - Media/thumbnail info
media - (array) - Text highlights
highlights - (string) - Cover image URL, or
coverfor auto-capture<screenshot> - (object) -
pleaseParseto trigger background metadata parsing{} - (string) - ISO 8601 creation date
created - (string) - ISO 8601 last update date
lastUpdate - (object) - Reminder settings
reminder
Deletion behaviour: Removing a raindrop moves it to Trash (collection ID ). Removing from Trash deletes permanently.
-99| 操作 | 请求方法 | 端点 |
|---|---|---|
| 获取雨滴 | GET | |
| 创建雨滴 | POST | |
| 更新雨滴 | PUT | |
| 删除雨滴 | DELETE | |
| 上传文件 | PUT | |
| 上传封面 | PUT | |
| 获取永久副本 | GET | |
| 推荐(新URL) | POST | |
| 推荐(已有) | GET | |
雨滴创建/更新字段:
- (字符串,创建时必填)- 书签URL
link - (字符串)- 书签标题
title - (字符串)- 简短描述
excerpt - (字符串)- 用户备注(支持Markdown)
note - (字符串数组)- 标签名称
tags - (对象)-
collection{"$id": collectionId} - (字符串)-
type,link,article,image,video,documentaudio - (布尔值)- 标记为收藏
important - (数字)- 排序顺序(升序)
order - (数组)- 媒体/缩略图信息
media - (数组)- 文本高亮
highlights - (字符串)- 封面图片URL,或
cover自动捕获<screenshot> - (对象)-
pleaseParse触发后台元数据解析{} - (字符串)- ISO 8601格式创建日期
created - (字符串)- ISO 8601格式最后更新日期
lastUpdate - (对象)- 提醒设置
reminder
删除行为:删除雨滴会将其移至回收站(集合ID )。从回收站删除则会永久删除。
-99Multiple Raindrop Operations
多个雨滴操作
| Operation | Method | Endpoint |
|---|---|---|
| Get raindrops | GET | |
| Create multiple | POST | |
| Update multiple | PUT | |
| Remove multiple | DELETE | |
| Export | GET | |
collectionId values:
- - All raindrops
0 - - Unsorted
-1 - - Trash
-99 - Any positive integer - Specific collection
Query parameters for GET /raindrops/{collectionId}:
- - Sort order:
sort(default),-created,created,score,-sort,title,-title,domain-domain - - Results per page (max 50)
perpage - - Page number (0-indexed)
page - - Search query (see
search)references/search-operators.md - - Boolean, include child collection bookmarks
nested
Bulk update fields (PUT with array or query):
idssearch- (boolean)
important - (array) - Appends tags; empty array clears all
tags - (array) - Appends; empty array clears
media - (string) - URL or
cover<screenshot> - (object) -
collectionto move{"$id": collectionId}
Export formats: , ,
csvhtmlzip| 操作 | 请求方法 | 端点 |
|---|---|---|
| 获取多个雨滴 | GET | |
| 批量创建 | POST | |
| 批量更新 | PUT | |
| 批量删除 | DELETE | |
| 导出 | GET | |
collectionId取值:
- - 所有雨滴
0 - - 未分类
-1 - - 回收站
-99 - 任意正整数 - 指定集合
GET /raindrops/{collectionId}的查询参数:
- - 排序方式:
sort(默认)、-created、created、score、-sort、title、-title、domain-domain - - 每页结果数(最大50)
perpage - - 页码(从0开始)
page - - 搜索查询(详见
search)references/search-operators.md - - 布尔值,是否包含子集合书签
nested
批量更新字段(PUT请求需携带数组或查询):
idssearch- (布尔值)
important - (数组)- 追加标签;空数组清空所有标签
tags - (数组)- 追加媒体;空数组清空
media - (字符串)- URL或
cover<screenshot> - (对象)-
collection用于移动雨滴{"$id": collectionId}
导出格式:, ,
csvhtmlzipCollections
集合
| Operation | Method | Endpoint |
|---|---|---|
| List root collections | GET | |
| List child collections | GET | |
| Get collection | GET | |
| Create collection | POST | |
| Update collection | PUT | |
| Upload cover | PUT | |
| Delete collection | DELETE | |
| Delete multiple | DELETE | |
| Reorder/expand all | PUT | |
| Merge collections | PUT | |
| Remove empty | PUT | |
| Empty trash | DELETE | |
| System collection counts | GET | |
| Search covers/icons | GET | |
| Featured covers | GET | |
Collection fields:
- (string) - Collection name
title - (string) - Display style:
view,list,simple,gridmasonry - (boolean) - Public accessibility
public - (object) -
parentfor nesting{"$id": parentCollectionId} - (number) - Sort position
sort - (array) - Cover image URLs
cover - (boolean) - Whether subcollections are expanded
expanded - (string) - Collection colour
color
System collections (non-removable):
- ID - "Unsorted"
-1 - ID - "Trash"
-99
Access levels ():
access.level- - Read only
1 - - Collaborator (write)
2 - - Collaborator (write + manage)
3 - - Owner
4
For sharing/collaborators, see .
references/collections-sharing.md| 操作 | 请求方法 | 端点 |
|---|---|---|
| 列出根集合 | GET | |
| 列出子集合 | GET | |
| 获取集合 | GET | |
| 创建集合 | POST | |
| 更新集合 | PUT | |
| 上传封面 | PUT | |
| 删除集合 | DELETE | |
| 批量删除 | DELETE | |
| 重新排序/展开所有 | PUT | |
| 合并集合 | PUT | |
| 移除空集合 | PUT | |
| 清空回收站 | DELETE | |
| 系统集合统计 | GET | |
| 搜索封面/图标 | GET | |
| 精选封面 | GET | |
集合字段:
- (字符串)- 集合名称
title - (字符串)- 显示样式:
view,list,simple,gridmasonry - (布尔值)- 是否公开访问
public - (对象)-
parent用于嵌套{"$id": parentCollectionId} - (数字)- 排序位置
sort - (数组)- 封面图片URL
cover - (布尔值)- 是否展开子集合
expanded - (字符串)- 集合颜色
color
系统集合(不可删除):
- ID - 「未分类」
-1 - ID - 「回收站」
-99
访问级别():
access.level- - 只读
1 - - 协作者(可编辑)
2 - - 协作者(可编辑+管理)
3 - - 所有者
4
关于共享/协作者的详情,请查看。
references/collections-sharing.mdTags
标签
| Operation | Method | Endpoint |
|---|---|---|
| Get tags | GET | |
| Rename tag | PUT | |
| Merge tags | PUT | |
| Remove tag(s) | DELETE | |
collectionId: Omit or use for tags from all collections.
0Get tags response:
json
{
"result": true,
"items": [{"_id": "tagname", "count": 42}]
}Rename tag:
bash
curl -s -X PUT \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"replace": "new-name", "tags": ["old-name"]}' \
"https://api.raindrop.io/rest/v1/tags/0"Merge tags (same endpoint, multiple tags in array):
bash
curl -s -X PUT \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"replace": "merged-name", "tags": ["tag1", "tag2", "tag3"]}' \
"https://api.raindrop.io/rest/v1/tags/0"Remove tags:
bash
curl -s -X DELETE \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"tags": ["tag-to-remove"]}' \
"https://api.raindrop.io/rest/v1/tags/0"| 操作 | 请求方法 | 端点 |
|---|---|---|
| 获取标签 | GET | |
| 重命名标签 | PUT | |
| 合并标签 | PUT | |
| 移除标签 | DELETE | |
collectionId:省略或使用表示所有集合的标签。
0获取标签响应示例:
json
{
"result": true,
"items": [{"_id": "tagname", "count": 42}]
}重命名标签:
bash
curl -s -X PUT \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"replace": "new-name", "tags": ["old-name"]}' \
"https://api.raindrop.io/rest/v1/tags/0"合并标签(同一端点,数组中传入多个标签):
bash
curl -s -X PUT \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"replace": "merged-name", "tags": ["tag1", "tag2", "tag3"]}' \
"https://api.raindrop.io/rest/v1/tags/0"移除标签:
bash
curl -s -X DELETE \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"tags": ["tag-to-remove"]}' \
"https://api.raindrop.io/rest/v1/tags/0"Highlights
高亮
| Operation | Method | Endpoint |
|---|---|---|
| Get all highlights | GET | |
| Get collection highlights | GET | |
| Get raindrop highlights | GET | |
| Add highlight | PUT | |
| Update highlight | PUT | |
| Delete highlight | PUT | |
For details, see .
references/highlights.md| 操作 | 请求方法 | 端点 |
|---|---|---|
| 获取所有高亮 | GET | |
| 获取集合高亮 | GET | |
| 获取雨滴高亮 | GET | |
| 添加高亮 | PUT | |
| 更新高亮 | PUT | |
| 删除高亮 | PUT | |
详情请查看。
references/highlights.mdFilters
筛选
bash
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/filters/{collectionId}" | jq '.'Use for all collections. Returns aggregated counts for broken links, duplicates, favourites, untagged items, tags, and content types.
0Query parameters:
- -
tagsSort(default) or-count(alphabetical)_id - - Additional search filter
search
bash
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/filters/{collectionId}" | jq '.'使用表示所有集合。返回失效链接、重复项、收藏、未标记项、标签及内容类型的聚合统计。
0查询参数:
- -
tagsSort(默认)或-count(按字母顺序)_id - - 额外的搜索筛选条件
search
User
用户
| Operation | Method | Endpoint |
|---|---|---|
| Get current user | GET | |
| Update user | PUT | |
| 操作 | 请求方法 | 端点 |
|---|---|---|
| 获取当前用户 | GET | |
| 更新用户信息 | PUT | |
Import
导入
| Operation | Method | Endpoint |
|---|---|---|
| Parse URL | GET | |
| Check URL existence | POST | |
| Parse HTML bookmark file | POST | |
| 操作 | 请求方法 | 端点 |
|---|---|---|
| 解析URL | GET | |
| 检查URL是否已存在 | POST | |
| 解析HTML书签文件 | POST | |
Backups
备份
| Operation | Method | Endpoint |
|---|---|---|
| List backups | GET | |
| Download backup | GET | |
| Generate new backup | GET | |
Formats: or
htmlcsv| 操作 | 请求方法 | 端点 |
|---|---|---|
| 列出备份 | GET | |
| 下载备份 | GET | |
| 生成新备份 | GET | |
格式:或
htmlcsvAuthentication: OAuth2 Flow
身份验证:OAuth2流程
For apps accessing other users' data (not personal use), use the full OAuth2 flow:
对于需要访问其他用户数据的应用(非个人使用),请使用完整的OAuth2流程:
Step 1: Authorise
步骤1:授权
Direct users to:
https://raindrop.io/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&response_type=code引导用户访问:
https://raindrop.io/oauth/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URI&response_type=codeStep 2: Exchange Code for Token
步骤2:用授权码交换Token
bash
curl -s -X POST "https://raindrop.io/oauth/access_token" \
-H "Content-Type: application/json" \
-d '{
"code": "AUTH_CODE",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"redirect_uri": "YOUR_REDIRECT_URI",
"grant_type": "authorization_code"
}' | jq '.'Response:
json
{
"access_token": "...",
"refresh_token": "...",
"expires_in": 1209599,
"token_type": "Bearer"
}bash
curl -s -X POST "https://raindrop.io/oauth/access_token" \
-H "Content-Type: application/json" \
-d '{
"code": "AUTH_CODE",
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"redirect_uri": "YOUR_REDIRECT_URI",
"grant_type": "authorization_code"
}' | jq '.'响应示例:
json
{
"access_token": "...",
"refresh_token": "...",
"expires_in": 1209599,
"token_type": "Bearer"
}Step 3: Refresh Token
步骤3:刷新Token
Access tokens expire after two weeks. Refresh with:
bash
curl -s -X POST "https://raindrop.io/oauth/access_token" \
-H "Content-Type: application/json" \
-d '{
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"refresh_token": "YOUR_REFRESH_TOKEN",
"grant_type": "refresh_token"
}' | jq '.'访问令牌两周后过期,可通过以下方式刷新:
bash
curl -s -X POST "https://raindrop.io/oauth/access_token" \
-H "Content-Type: application/json" \
-d '{
"client_id": "YOUR_CLIENT_ID",
"client_secret": "YOUR_CLIENT_SECRET",
"refresh_token": "YOUR_REFRESH_TOKEN",
"grant_type": "refresh_token"
}' | jq '.'Error Handling
错误处理
Check HTTP status codes:
- - Success
200 - - Success, no content
204 - - Bad request
400 - - Authentication failed (check token)
401 - - Forbidden (insufficient permissions)
403 - - Resource not found
404 - - Rate limited (120 req/min exceeded)
429 - - Server error
5xx
检查HTTP状态码:
- - 成功
200 - - 成功,无返回内容
204 - - 请求错误
400 - - 身份验证失败(检查Token)
401 - - 禁止访问(权限不足)
403 - - 资源不存在
404 - - 请求超限(超过每分钟120次限制)
429 - - 服务器错误
5xx
Example with Error Handling
带错误处理的示例
bash
response=$(curl -s -w "\n%{http_code}" \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/raindrops/0")
http_code=$(echo "$response" | tail -1)
body=$(echo "$response" | sed '$d')
if [ "$http_code" -ge 200 ] && [ "$http_code" -lt 300 ]; then
echo "$body" | jq '.'
else
echo "Error: HTTP $http_code"
echo "$body"
fibash
response=$(curl -s -w "\n%{http_code}" \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/raindrops/0")
http_code=$(echo "$response" | tail -1)
body=$(echo "$response" | sed '$d')
if [ "$http_code" -ge 200 ] && [ "$http_code" -lt 300 ]; then
echo "$body" | jq '.'
else
echo "Error: HTTP $http_code"
echo "$body"
fiCommon Patterns
常见用法
List All Bookmarks in a Collection
列出集合中的所有书签
bash
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/raindrops/COLLECTION_ID?perpage=50" | jq '.items[] | {title, link}'bash
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/raindrops/COLLECTION_ID?perpage=50" | jq '.items[] | {title, link}'Create a Bookmark
创建书签
bash
curl -s -X POST \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"link": "https://example.com",
"title": "Example Site",
"tags": ["reference", "example"],
"collection": {"$id": COLLECTION_ID},
"pleaseParse": {}
}' \
"https://api.raindrop.io/rest/v1/raindrop" | jq '.'bash
curl -s -X POST \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"link": "https://example.com",
"title": "Example Site",
"tags": ["reference", "example"],
"collection": {"$id": COLLECTION_ID},
"pleaseParse": {}
}' \
"https://api.raindrop.io/rest/v1/raindrop" | jq '.'Search Bookmarks
搜索书签
bash
undefinedbash
undefinedSearch across all collections
搜索所有集合
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN"
"https://api.raindrop.io/rest/v1/raindrops/0?search=YOUR_QUERY" | jq '.items[] | {title, link}'
"https://api.raindrop.io/rest/v1/raindrops/0?search=YOUR_QUERY" | jq '.items[] | {title, link}'
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN"
"https://api.raindrop.io/rest/v1/raindrops/0?search=YOUR_QUERY" | jq '.items[] | {title, link}'
"https://api.raindrop.io/rest/v1/raindrops/0?search=YOUR_QUERY" | jq '.items[] | {title, link}'
Search with tag filter
按标签筛选搜索
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN"
"https://api.raindrop.io/rest/v1/raindrops/0?search=%23tagname" | jq '.items[] | {title, link}'
"https://api.raindrop.io/rest/v1/raindrops/0?search=%23tagname" | jq '.items[] | {title, link}'
See `references/search-operators.md` for the complete search query syntax.curl -s -H "Authorization: Bearer $RAINDROP_TOKEN"
"https://api.raindrop.io/rest/v1/raindrops/0?search=%23tagname" | jq '.items[] | {title, link}'
"https://api.raindrop.io/rest/v1/raindrops/0?search=%23tagname" | jq '.items[] | {title, link}'
完整的搜索查询语法请查看`references/search-operators.md`。Move Bookmark to a Collection
移动书签到指定集合
bash
curl -s -X PUT \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"collection": {"$id": TARGET_COLLECTION_ID}}' \
"https://api.raindrop.io/rest/v1/raindrop/RAINDROP_ID" | jq '.'bash
curl -s -X PUT \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"collection": {"$id": TARGET_COLLECTION_ID}}' \
"https://api.raindrop.io/rest/v1/raindrop/RAINDROP_ID" | jq '.'Get All Tags
获取所有标签
bash
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/tags/0" | jq '.items[] | {tag: ._id, count}'bash
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/tags/0" | jq '.items[] | {tag: ._id, count}'Create a Collection
创建集合
bash
curl -s -X POST \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "My Collection", "view": "list"}' \
"https://api.raindrop.io/rest/v1/collection" | jq '.'bash
curl -s -X POST \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"title": "My Collection", "view": "list"}' \
"https://api.raindrop.io/rest/v1/collection" | jq '.'List All Collections (Root + Children)
列出所有集合(根集合+子集合)
bash
undefinedbash
undefinedRoot collections
根集合
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN"
"https://api.raindrop.io/rest/v1/collections" | jq '.items[] | {id: ._id, title}'
"https://api.raindrop.io/rest/v1/collections" | jq '.items[] | {id: ._id, title}'
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN"
"https://api.raindrop.io/rest/v1/collections" | jq '.items[] | {id: ._id, title}'
"https://api.raindrop.io/rest/v1/collections" | jq '.items[] | {id: ._id, title}'
Child collections
子集合
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN"
"https://api.raindrop.io/rest/v1/collections/childrens" | jq '.items[] | {id: ._id, title, parent: .parent."$id"}'
"https://api.raindrop.io/rest/v1/collections/childrens" | jq '.items[] | {id: ._id, title, parent: .parent."$id"}'
undefinedcurl -s -H "Authorization: Bearer $RAINDROP_TOKEN"
"https://api.raindrop.io/rest/v1/collections/childrens" | jq '.items[] | {id: ._id, title, parent: .parent."$id"}'
"https://api.raindrop.io/rest/v1/collections/childrens" | jq '.items[] | {id: ._id, title, parent: .parent."$id"}'
undefinedPaginate Through All Bookmarks
分页遍历所有书签
bash
page=0
while true; do
response=$(curl -s -H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/raindrops/0?perpage=50&page=$page")
count=$(echo "$response" | jq '.items | length')
echo "$response" | jq '.items[] | {title, link}'
if [ "$count" -lt 50 ]; then
break
fi
page=$((page + 1))
donebash
page=0
while true; do
response=$(curl -s -H "Authorization: Bearer $RAINDROP_TOKEN" \
"https://api.raindrop.io/rest/v1/raindrops/0?perpage=50&page=$page")
count=$(echo "$response" | jq '.items | length')
echo "$response" | jq '.items[] | {title, link}'
if [ "$count" -lt 50 ]; then
break
fi
page=$((page + 1))
doneExport Bookmarks
导出书签
bash
undefinedbash
undefinedExport all bookmarks as CSV
导出所有书签为CSV
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN"
"https://api.raindrop.io/rest/v1/raindrops/0/export.csv" -o bookmarks.csv
"https://api.raindrop.io/rest/v1/raindrops/0/export.csv" -o bookmarks.csv
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN"
"https://api.raindrop.io/rest/v1/raindrops/0/export.csv" -o bookmarks.csv
"https://api.raindrop.io/rest/v1/raindrops/0/export.csv" -o bookmarks.csv
Export as HTML
导出为HTML
curl -s -H "Authorization: Bearer $RAINDROP_TOKEN"
"https://api.raindrop.io/rest/v1/raindrops/0/export.html" -o bookmarks.html
"https://api.raindrop.io/rest/v1/raindrops/0/export.html" -o bookmarks.html
undefinedcurl -s -H "Authorization: Bearer $RAINDROP_TOKEN"
"https://api.raindrop.io/rest/v1/raindrops/0/export.html" -o bookmarks.html
"https://api.raindrop.io/rest/v1/raindrops/0/export.html" -o bookmarks.html
undefinedCheck if URL Already Saved
检查URL是否已保存
bash
curl -s -X POST \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"urls": ["https://example.com"]}' \
"https://api.raindrop.io/rest/v1/import/url/exists" | jq '.'bash
curl -s -X POST \
-H "Authorization: Bearer $RAINDROP_TOKEN" \
-H "Content-Type: application/json" \
-d '{"urls": ["https://example.com"]}' \
"https://api.raindrop.io/rest/v1/import/url/exists" | jq '.'Pagination
分页
Raindrop uses page-based pagination (not cursor-based):
- - Page number (0-indexed)
page - - Items per page (max 50, default 25 for highlights)
perpage
When the number of items returned is less than , you have reached the last page.
perpageRaindrop使用基于页码的分页(而非游标分页):
- - 页码(从0开始)
page - - 每页条目数(最大50,高亮默认25)
perpage
当返回的条目数少于时,说明已到达最后一页。
perpageNested Collection Structure
嵌套集合结构
Collections are organised hierarchically. Reconstructing the full sidebar requires:
- - Returns
GET /userarray with collection orderinggroups - - Root collections
GET /collections - - Nested collections
GET /collections/childrens
Root collection sort order is persisted in the user's array. Child collection sort order is stored in the collection's field.
groups[].collectionssort集合采用层级结构组织。重建完整侧边栏需要:
- - 返回包含集合排序信息的
GET /user数组groups - - 获取根集合
GET /collections - - 获取嵌套集合
GET /collections/childrens
根集合的排序顺序保存在用户的数组中。子集合的排序顺序存储在集合的字段中。
groups[].collectionssortAdditional Reference
额外参考
For detailed documentation on specific topics, consult:
- - Search query syntax and operators
references/search-operators.md - - Collection sharing and collaborators
references/collections-sharing.md - - Highlight management
references/highlights.md
关于特定主题的详细文档,请参考:
- - 搜索查询语法与运算符
references/search-operators.md - - 集合共享与协作者
references/collections-sharing.md - - 高亮管理
references/highlights.md
Workflow Summary
工作流程总结
- Resolve token - Environment, context, or ask user
- Verify authentication - Test with
GET /user - Read operations - Execute directly without confirmation
- Write operations - Ask for confirmation before executing
- Handle pagination - Loop with page number until items < perpage
- Parse responses - Use jq to extract and format data
- 获取Token - 优先从环境变量、上下文获取,否则询问用户
- 验证身份 - 调用测试
GET /user - 只读操作 - 直接执行无需确认
- 写入操作 - 执行前需征得用户确认
- 处理分页 - 循环递增页码,直到返回条目数小于每页限制
- 解析响应 - 使用jq提取并格式化数据