提问人:ahmad 提问时间:11/15/2023 更新时间:11/15/2023 访问量:21
如何使用 API 更新 Confluence 页面
How to update Confluence pages using API
问:
我正在尝试使用 confluence 服务器 API 更新 confluence 页面。 我遵循了他们的文档,但不断收到错误 我的命令行:
curl -u username:password-X PUT -H 'Content-Type: application/json' -d '{"type": "page","title": "testing 1 2 3","space": {"key": "TST"},"body": {"storage": {"value": "<p>from cmd</p>","representation": "storage"}},"version":{"number" : 6}}' https://someserver.com/confluence/rest/api/content/12345678 | python -mjson.tool
我一直收到这个错误
curl: (3) URL using bad/illegal format or missing URL
curl: (3) URL using bad/illegal format or missing URL
curl: (3) unmatched brace in URL position 1:
{key:
^
Expecting value: line 1 column 1 (char 0)
我尝试将数据放入 API.json 文件中,但仍然没有运气。
curl -u username:password-X PUT -H 'Content-Type: application/json' -d 'API.json' https://someserver.com/confluence/rest/api/content/12345678 | python -mjson.tool
我还尝试在 python 中使用 requests 库中的 put 函数,但没有运气,我在 confluence 页面上没有得到任何更新
data = {
"id": "123456789",
"type": "page",
"title": "testing 1 2 3",
"space": {
"key": "TST"
},
"body": {
"storage": {
"value": "<p>from python</p>",
"representation": "storage"
}
},
"version": {
"number": 6
}
}
r = req.put('https://someserver.com/confluence/rest/api/content/123456789', auth= ('username', 'password'), data=data , headers={'Content-Type': 'application/json'})
我想要一种使用 CMD 和/或 python 请求库来做到这一点的方法。我在这里找到了这个论坛,有人在那里使用 Atlassian 库,但这不是我想要的。 第二个答案对我不起作用,因为它就像我的 python 代码一样,两者都不会更新页面。 请问有什么帮助吗?
答: 暂无答案
评论