api在汇合时创建一个新页面

时间:2016-02-26 05:49:30

标签: curl confluence jira-rest-api confluence-rest-api

我是汇总组的成员,我从浏览器打开以下网址

a

点击此页面会显示登录页面,我在其中输入凭据并开始创建新页面等。

我想从API执行此操作。我已经阅读了互联网上的几篇帖子,觉得这个下面的curl命令应该可以工作。

https://kensci.atlassian.net/wiki/collector/pages.action?key=MyKyey

但是,如何用网址http://localhost:8090/rest/api/content/?os_authType=basic替换?我是否使用我在浏览器中打开的https://kensci.atlassian.net/wiki/collector/pages.action?key=MyKey/?os_authType=basic

替换它

我试过这个,所以最后字符串看起来如下

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"

但它不会创建一个页面,只会吐出大量的HTML。

2 个答案:

答案 0 :(得分:0)

你的卷发看起来很好,除了网址。

编辑: 请尝试替换&#34; http://localhost:8090/rest/api/content/?os_authType=basic&#34;使用以下内容:&#34; https://kensci.atlassian.net/wiki/rest/api/content/?os_authType=basic&#34;。您可能需要添加&#34; / collector&#34;在&#34; / wiki&#34;。

之后

如果这不起作用,请发布您正在获得的输出。

答案 1 :(得分:0)

尝试以下curl命令。我试过了,它可以和我的wiki网址一起使用。

curl -v -S -u username:password -X POST -H "Content-Type: application/json" -d'{"type":"page","title":"new page","space":{"key":"ATTACH"},"body":{"storage":{"value":"<p>This is a new testpage</p>","representation":"storage"}}}' https://kensci.atlassian.net/rest/api/content
相关问题