Conflunce API 创建更新页面_confluence api

这里写自定义目录标题

Conflunce API 创建更新页面

官方api文档地址:https://docs.atlassian.com/ConfluenceServer/rest/7.11.6/#api/content

**conflunce_host Conflunce服务host
port Conflunce服务port
space_key 空间的key
page_id 页面ID
**

获取页面信息 :
接口参数:

属性类型是否必须默认值示例说明
spaceKeyStringYspace_keyspace_key空间key
title StringYtitle_name页面page名
expandStringNspace,body.view,version,container页面属性信息

Example:

GET http://conflunce_host:port/rest/api/content?spaceKey=space_key&title=test_page&expand=space,body.view,version,container
使用此接口获取 space_key、page_id

创建页面:
接口参数:

属性类型是否必须默认值示例说明
typeStringYpagepagethe content type to return. Default value: page.
statusStringYcurrentcurrentlist of statuses the content to be found is in. Defaults to current is not specified. If set to ‘any’, content in ‘current’ and ‘trashed’ status will be fetched. Does not support ‘historical’ status for now.
titleStringY页面page名
spaceStringY{“key”: “space_key”}空间key信息
ancestorsStringY[{“id”: page_id}]父页面ID
bodyStringY页面body内容

Example:

POST http://conflunce_host:port/rest/api/content

{
    "type": "page",
	"status": "current",
	"title": "just test confluence api create page",
	"space": {"key": "space_key"},
	"ancestors": [{"id": 11111111}],
	"body": {"storage": {"value": "<p>New page data for confluence api create page.</p>","representation": "storage"}}
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

更新conflunce页面:
接口参数:

属性类型是否必须默认值示例说明
typeStringYpagepagethe content type to return. Default value: page.
statusStringYcurrentcurrentlist of statuses the content to be found is in. Defaults to current is not specified. If set to ‘any’, content in ‘current’ and ‘trashed’ status will be fetched. Does not support ‘historical’ status for now.
versionStringY{ “number”: 2 }最新的版本号+1
titleStringY页面page名
spaceStringY{“key”: “space_key”} 空间key信息
ancestorsStringY[{“id”: page_id}]父页面ID
bodyStringY页面body内容

Example:

PUT http://conflunce_host:port/rest/api/content/update_page_id

{    
	"type": "page",
    "status": "current",
    "version": {        "number": 2    },
    "title": "just test confluence api create page",
    "space": {        "key": "space_key"    },
    "ancestors": [        {            "id": 111111111        }    ],
    "body": {        "storage": {            "value": "<p>New page data for confluence api update page.</p>",            "representation": "storage"        }
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10