我是一个 confluence 组的成员,我从以下 URL 从浏览器中打开该组
https://kensci.atlassian.net/wiki/collector/pages.action?key=MyKyey
点击这个页面会给我登录页面,我在其中输入我的凭据并开始创建一个新页面等。
我想通过 API 做到这一点。我已经阅读了互联网上的几篇文章,觉得下面的 curl 命令应该可以工作。
curl -v -u admin:admin -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d'{"type":"page","title":"new page","space":{"key":"ATTACH"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}' "http://localhost:8090/rest/api/content/?os_authType=basic"
但是,我应该用什么替换 URL http://localhost:8090/rest/api/content/?os_authType=basic?我是否将其替换为从浏览器打开的 URL,即https://kensci.atlassian.net/wiki/collector/pages.action?key=MyKey/?os_authType=basic
我已经尝试过了,所以最后字符串看起来如下
curl -v -u myusername:mypassword -X POST -H 'Content-Type: application/json' -H 'Accept: application/json' -d'{"type":"page","title":"new page","space":{"key":"ATTACH"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}' "https://kensci.atlassian.net/wiki/collector/pages.action?key=MyKey/?os_authType=basic"
但它不会创建页面,只会吐出大量的 HTML。