评论 REST API
Available in Team plan
评论 REST API 允许用户从 Tiptap 编辑器外部管理评论线程和单个评论。它支持创建、更新、删除和检索线程与评论。
使用 评论 Postman 集合 进行动手实验。
Access the API
REST API 直接从您的文档服务器提供,位于您的自定义 URL:
https://YOUR_APP_ID.collab.tiptap.cloud/身份验证使用 API 密钥,您可以在文档服务器的 设置 中找到。密钥必须作为 Authorization 头发送。
如果您的文档标识符包含斜杠 (/),请将其编码为 %2F,例如使用 encodeURIComponent。
查看所有 API 端点
| 操作 | 方法 | 端点 | 描述 |
|---|---|---|---|
| 创建线程 | POST | /api/documents/:identifier/threads | 在文档中创建一个新线程 |
| 获取线程 | GET | /api/documents/:identifier/threads | 列出所有线程并查看其详细信息 |
| 获取线程 | GET | /api/documents/:identifier/threads/:threadIdentifier | 检索特定线程 |
| 更新线程 | PATCH | /api/documents/:identifier/threads/:threadIdentifier | 修改现有线程的属性 |
| 更新评论 | PATCH | /api/documents/:identifier/threads/:threadIdentifier/comments/:commentIdentifier | 更新评论的内容或元数据 |
| 删除线程 | DELETE | /api/documents/:identifier/threads/:threadIdentifier | 从文档中删除特定线程 |
| 删除评论 | DELETE | /api/documents/:identifier/threads/:threadIdentifier/comments/:commentIdentifier | 从线程中删除特定评论 |
线程 REST API 端点
获取线程
GET /api/documents/:identifier/threads检索与特定文档相关的所有评论线程。使用此端点列出所有线程并查看它们的详细信息。
curl --location 'https://YOUR_APP_ID.collab.tiptap.cloud/api/documents/{document_id}/threads' \
--header 'Authorization: {{Authorization}}'获取线程
GET /api/documents/:identifier/threads/:threadIdentifier使用文档中唯一标识符获取特定线程的详细信息。这对于检索特定讨论线程很有用。
curl --location 'https://YOUR_APP_ID.collab.tiptap.cloud/api/documents/{document_id}/threads/{thread_id}' \
--header 'Authorization: {{Authorization}}'创建线程
POST /api/documents/:identifier/threads在文档中创建一个新线程。您可以指定初始内容和用户元数据等附加数据。
curl --location 'https://YOUR_APP_ID.collab.tiptap.cloud/api/documents/{document_id}/threads' \
--header 'Content-Type: application/json' \
--header 'Authorization: {{Authorization}}' \
--data '{
"content": "moin",
"data": { "key": "ttt"}
}'更新线程
PATCH /api/documents/:identifier/threads/:threadIdentifier修改现有线程的属性,例如将其标记为已解决或更新其元数据。
curl --location --request PATCH 'https://YOUR_APP_ID.collab.tiptap.cloud/api/documents/{document_id}/threads/{thread_id}' \
--header 'Content-Type: application/json' \
--header 'Authorization: {{Authorization}}' \
--data '{
"resolvedAt": null
}'删除线程
DELETE /api/documents/:identifier/threads/:threadIdentifier从文档中删除特定线程,有效地删除所有嵌套评论。
curl --location --request DELETE 'https://YOUR_APP_ID.collab.tiptap.cloud/api/documents/{document_id}/threads/{thread_id}' \
--header 'Authorization: {{Authorization}}'评论 REST API 端点
创建评论
POST /api/documents/:identifier/threads/:threadIdentifier/comments向现有线程添加新评论。指定内容和任何相关数据。
curl --location 'https://YOUR_APP_ID.collab.tiptap.cloud/api/documents/{document_id}/threads/{thread_id}/comments' \
--header 'Content-Type: application/json' \
--header 'Authorization: {{Authorization}}' \
--data '{
"content": "test",
"data": { "key": "ttt"}
}'更新评论
PATCH /api/documents/:identifier/threads/:threadIdentifier/comments/:commentIdentifier更新线程中现有评论的内容或元数据。
curl --location --request PATCH 'https://YOUR_APP_ID.collab.tiptap.cloud/api/documents/{document_id}/threads/{thread_id}/comments/{comment_id}' \
--header 'Content-Type: application/json' \
--header 'Authorization: {{Authorization}}' \
--data '{
"content": "UPDATED!"
}'删除评论
DELETE /api/documents/:identifier/threads/:threadIdentifier/comments/:commentIdentifier从线程中删除特定评论。使用此功能来管理单个评论。
curl --location --request DELETE 'https://YOUR_APP_ID.collab.tiptap.cloud/api/documents/{document_id}/threads/{thread_id}/comments/{comment_id}' \
--header 'Authorization: {{Authorization}}'查看 Postman 集合
使用 评论 Postman 集合 进行动手实验。