2017-05-10 17 views
-1

我想通過rest api更新匯合頁面。我從來沒有處理過它,請建議代碼片段,我可以通過「頁面名稱」更新頁面。說我的匯合網站爲https:\ wiki.mydomain.com和頁面名稱是「TEST」的空間是「TST」使用python代碼更新/刪除匯合頁面

回答

0

正如你在Atlassian的之證件見(here),您可以通過以下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 

但它適用於頁面標識而不是頁面標題。你可以抓住的ID與以下內容:

curl -u admin:admin -X GET "http://localhost:8080/confluence/rest/api/content?title=myPage%20Title 
&spaceKey=TST&expand=history" | python -mjson.tool 

正如一個側面說明,因爲你看起來像一個新的用戶,在這裏我們將不提供代碼片段,你需要告訴我們你已經嘗試什麼,什麼是你的問題其實。我建議你也看看How do I ask a good question以及:-)