如何使用curl更新页面而不覆盖

如何使用curl更新页面而不覆盖,curl,confluence,Curl,Confluence,如何使用curl更新页面而不覆盖内容? 我必须更新Atlassian页面的内容,但所有内容都被覆盖了 我使用: curl -u login:password -X PUT -H "Content-Type:application/json" -d @json.txt https://mysite/rest/api/content/id | python -mjson.tool 有什么想法吗?有了你的问题,我知道你想编辑页面的一部分。如果是这种情况,则需要先获取内容,然后编辑内容,然后将内容传递

如何使用curl更新页面而不覆盖内容? 我必须更新Atlassian页面的内容,但所有内容都被覆盖了

我使用:

curl -u login:password -X PUT -H "Content-Type:application/json" -d @json.txt https://mysite/rest/api/content/id | python -mjson.tool

有什么想法吗?

有了你的问题,我知道你想编辑页面的一部分。如果是这种情况,则需要先获取内容,然后编辑内容,然后将内容传递给存储部分中的
curl
命令:

curl -u admin:admin -X PUT -H 'Content-Type: application/json' -d'{"id":"3604482","type":"page","title":"new page","space":{"key":"TST"},"body":{"storage":{"value":"<p>This is the updated text for the new page</p>","representation":"storage"}},"version":{"number":2}}' http://localhost:8080/confluence/rest/api/content/3604482 | python -mjson.tool
有关Confluence REST API的更多信息,请参阅Atlassian官方文档

curl -u admin:admin http://localhost:8080/confluence/rest/api/content/3965072?expand=body.storage | python -mjson.tool