Confluence集成实践:2:Confluence的RestAPI

Confluence提供了标准的RestAPI,应用程序的开发者使用这些API可以将Confluence的部分功能集成到他们的应用程序中,而负责管理Confluence服务器的管理员也可用利用这些RestAPI将那些交互式的操作进行脚本化从而自动化提高效率。这篇文章将会介绍Confluence的RestAPI有哪些功能。

版本

本文介绍和演示用的Confluence的版本信息如下:

项目版本信息
Confluence试用版6.3.3

Confluence的RestAPI特点

Confluence提供了标准的RestAPI,通过URI进行操作,Response的格式是JSON,操作则是HTTP的标准操作诸如:GET/PUT/POST/DELETE。
另外REST API基于开放的标准,所以基本上可以使用任何开发语言去使用这些API。

Confluence REST API

空间管理

空间操作

项目HTTP方法REST API
获取所有的空间信息GET/rest/space
创建空间POST/rest/space
创建私有空间POST/rest/space/_private
更新空间信息PUT/rest/space/{spaceKey}
删除空间DELETE/rest/space/{spaceKey}
获取某一空间信息GET/rest/space/{spaceKey}
获取空间下的内容信息GET/rest/space/{spaceKey}/content
获取空间下的内容信息类型GET/rest/space/{spaceKey}/content/{type}

属性操作

项目HTTP方法REST API
获取某一空间所有属性GET/rest/space/{spaceKey}/property
创建某一空间属性POST/rest/space/{spaceKey}/property
按key获取某一空间属性信息GET/rest/space/{spaceKey}/property/{key}
更新某一空间属性信息PUT/rest/space/{spaceKey}/property/{key}
删除某一空间属性DELETE/rest/space/{spaceKey}/property/{key}
创建某一空间属性信息POST/rest/space/{spaceKey}/property/{key}

用户操作

项目HTTP方法REST API
获取所有用户信息GET/rest/user
获取匿名用户信息GET/rest/user/anonymous
获取当前用户信息GET/rest/user/current
获取用户组信息GET/rest/user/memberof

用户组操作

项目HTTP方法REST API
获取所有用户组信息GET/rest/group
获取某一用户组信息groupGET
获取某一用户组成员信息membersGET

内容(content)管理

内容操作

项目HTTP方法REST API
创建contentPOST/rest/content
获取content信息GET/rest/content
更新内容信息PUT/rest/content/{contentId}
按内容id获取内容信息GET/rest/content/{id}
删除contentDELETE/rest/content/{id}
获取content历史信息GET/rest/content/{id}/history
使用hash获取宏内容GET/rest/content/{id}/history/{version}/macro/hash/{hash}
使用宏id获取宏内容GET/rest/content/{id}/history/{version}/macro/id/{macroId}
查询内容信息GET/rest/content/search

child操作

项目HTTP方法REST API
获取内容下child相关信息GET/rest/content/{id}/child
获取child类型信息GET/rest/content/{id}/child/{type}
获取child相关注释信息GET/rest/content/{id}/child/comment

附件操作

项目HTTP方法REST API
创建附件POST/rest/content/{id}/child/attachment
获取附件GET/rest/content/{id}/child/attachment
更新附件PUT/rest/content/{id}/child/attachment/{attachmentId}
更新附件数据POST/rest/content/{id}/child/attachment/{attachmentId}/data

派生操作

项目HTTP方法REST API
获取内容派生信息GET/rest/content/{id}/descendant
获取内容派生类型GET/rest/content/{id}/descendant/{type}

标签操作

项目HTTP方法REST API
获取某一内容下所有标签信息GET/rest/content/{id}/label
添加标签POST/rest/content/{id}/label
删除某一内容的标签DELETE/rest/content/{id}/label
删除某一标签DELETE/rest/content/{id}/label/{label}

属性操作

项目HTTP方法REST API
获取某一内容的所有属性GET/rest/content/{id}/property
创建属性POST/rest/content/{id}/property
获取某一属性信息GET/rest/content/{id}/property/{key}
更新属性信息PUT/rest/content/{id}/property/{key}
删除属性DELETE/rest/content/{id}/property/{key}
创建某一特定属性POST/rest/content/{id}/property/{key}

限制操作

项目HTTP方法REST API
获取某一操作相关的所有限制GET/rest/content/{id}/restriction/byOperation
获取某一操作所需的所有限制GET/rest/content/{id}/restriction/byOperation/{operationKey}

blueprint操作

项目HTTP方法REST API
发布legacy draftPOST/rest/content/blueprint/instance/{draftId}
发布shared draftPUT/rest/content/blueprint/instance/{draftId}

转换操作

项目HTTP方法REST API
ConvertPOST/rest/contentbody/convert/{to}

查询操作

项目HTTP方法REST API
使用CQL进行查询GET/rest/search

审核操作

项目HTTP方法REST API
获取所有audit信息GET/rest/audit
存储相关记录POST/rest/audit
导出所有信息GET/rest/audit/export
获取retention信息GET/rest/audit/retention
设定retention信息PUT/rest/audit/retention
获取某一时间后的所有audit信息GET/rest/audit/since

longtask

提供对于Confluence的longtask的查询相关的API接口。

项目HTTP方法REST API
获取所有的longtask信息GET/rest/longtask
获取某一longtask信息GET/rest/longtask/{id}

参考文章

https://docs.atlassian.com/atlassian-confluence/REST/latest-server/#space-createSpace
https://developer.atlassian.com/confdev/confluence-server-rest-api/confluence-rest-api-examples

  • 8
    点赞
  • 30
    收藏
    觉得还不错? 一键收藏
  • 6
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值