tweetsmash-api
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTweetSmash API
TweetSmash API
Use this skill to work directly with the TweetSmash REST API after verifying the current docs. Read before choosing an endpoint. Read only when bookmark filtering is required.
references/api-reference.mdreferences/bookmarks-filters.md使用本技能可在核对当前文档后直接调用TweetSmash REST API。选择端点前请先阅读。仅当需要书签筛选功能时再阅读。
references/api-reference.mdreferences/bookmarks-filters.mdProcedures
操作步骤
Step 1: Validate Credentials and Scope
- Confirm that a TweetSmash API key is available before making requests. Prefer in the shell environment.
TWEETSMASH_API_KEY - Read to confirm the current endpoint, required headers, rate limits, and status codes.
references/api-reference.md - If the task requires bookmark filtering or pagination, read .
references/bookmarks-filters.md
Step 2: Build the Request
- Use on every request.
Authorization: Bearer $TWEETSMASH_API_KEY - Use for all examples in this skill. Keep the base URL as
Content-Type: application/json.https://api.tweetsmash.com/v1 - If the task fetches bookmarks with filters, execute with the needed flags to generate a correctly encoded URL.
python3 scripts/build-bookmarks-url.py - If the task adds labels, start from and fill in
assets/add-labels-body.jsonplus eithertweet_idsorlabel_id.label_name - If the task removes labels, start from and fill in
assets/remove-labels-body.jsonplustweet_ids.label_name
Step 3: Execute the Correct Endpoint
- Fetch bookmarks with . Use the URL from
GET /bookmarkswhen filters, search, or cursors are present.scripts/build-bookmarks-url.py - List labels with when the task needs current label IDs, label names, or usage counts.
GET /labels - Add labels with when the task needs to organize one or more bookmarked tweets.
POST /labels/add - Remove labels with when the task needs to clean up or reclassify bookmarked tweets.
POST /labels/remove - Use cURL for quick execution or translate the same request into the caller’s runtime only after the endpoint and payload are confirmed.
Step 4: Verify the Response
- Confirm that the response JSON contains before reporting success.
"status": true - For bookmark reads, inspect ,
meta.next_cursor, andmeta.limitwhen pagination matters.meta.total_count - For label mutations, confirm the success message matches the intended action.
- If the task depends on label existence, call again after a mutation to verify the resulting state.
GET /labels
Step 5: Return a Usable Result
- Summarize the request method, endpoint, and effective filters or payload fields that were used.
- Return the response body or a structured summary, depending on the caller’s requested output format.
- If follow-up pagination is possible, expose so the next request can continue from the prior page.
meta.next_cursor
步骤1:验证凭证与权限范围
- 发起请求前确认TweetSmash API密钥可用,优先使用shell环境中的。
TWEETSMASH_API_KEY - 阅读确认当前端点、必填请求头、速率限制和状态码。
references/api-reference.md - 如果任务需要书签筛选或分页,阅读。
references/bookmarks-filters.md
步骤2:构建请求
- 所有请求都携带请求头。
Authorization: Bearer $TWEETSMASH_API_KEY - 本技能中的所有示例均使用请求头,基础URL固定为
Content-Type: application/json。https://api.tweetsmash.com/v1 - 如果任务需要带筛选条件获取书签,携带所需参数执行来生成编码正确的URL。
python3 scripts/build-bookmarks-url.py - 如果任务需要添加标签,基于文件填写
assets/add-labels-body.json以及tweet_ids或label_id字段。label_name - 如果任务需要移除标签,基于文件填写
assets/remove-labels-body.json和tweet_ids字段。label_name
步骤3:调用正确端点
- 使用获取书签,存在筛选、搜索或游标参数时使用
GET /bookmarks生成的URL。scripts/build-bookmarks-url.py - 当任务需要获取当前标签ID、标签名称或使用计数时,使用列出所有标签。
GET /labels - 当任务需要整理一个或多个已收藏推文时,使用添加标签。
POST /labels/add - 当任务需要清理或重新分类已收藏推文时,使用移除标签。
POST /labels/remove - 确认端点和请求payload无误后,可使用cURL快速执行请求,也可将相同请求转换为调用方运行环境支持的形式。
步骤4:验证响应
- 上报成功前先确认响应JSON中包含。
"status": true - 对于书签读取操作,需要分页时检查、
meta.next_cursor和meta.limit字段。meta.total_count - 对于标签变更操作,确认成功提示与预期操作匹配。
- 如果任务依赖标签存在性,变更完成后再次调用验证最终状态。
GET /labels
步骤5:返回可用结果
- 汇总使用的请求方法、端点,以及生效的筛选条件或payload字段。
- 根据调用方要求的输出格式,返回响应体或结构化汇总结果。
- 如果支持后续分页,返回以便下一次请求可以从上一页的位置继续。
meta.next_cursor
Error Handling
错误处理
- If authentication fails with , confirm that the bearer token is present, non-empty, and taken from the correct TweetSmash account.
401 - If the API returns , stop and report that the current plan does not permit the requested API access.
402 - If the API returns , stop sending additional requests, note the documented limit of 100 requests per hour per API key, and retry later.
429 - If a bookmark query becomes hard to assemble by hand, rerun and rebuild the URL instead of manually concatenating query strings.
python3 scripts/build-bookmarks-url.py --help - If a label mutation is ambiguous, list labels first with and then rerun the mutation using the confirmed label identifier or label name.
GET /labels
- 如果鉴权失败返回,确认Bearer Token存在、非空,且来自正确的TweetSmash账号。
401 - 如果API返回,停止操作并上报当前套餐不支持请求的API访问权限。
402 - 如果API返回,停止发送额外请求,留意文档规定的每个API密钥每小时最多100次请求的限制,稍后再重试。
429 - 如果手动拼接书签查询URL过于复杂,重新执行来重建URL,不要手动拼接查询字符串。
python3 scripts/build-bookmarks-url.py --help - 如果标签变更操作存在歧义,先调用列出所有标签,再使用确认后的标签ID或标签名称重新执行变更操作。
GET /labels