使用 Curl 脚本创建的页面。未显示在 Confluence 页面上。需要建议
Page created using Curl script. Not showing up on Confluence page. Need suggestions
我一直无法使用以下 curl 脚本创建汇合页面。
curl -v -S -u user:pass -X POST -H 'Content-Type: application/json' -d'{"type":"page","title":"TestPage","space":{"key":"Cloud"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}' https://Client.atlassian.net/wiki/display/CD/Applications | python -mjson.tool
脚本执行正常并显示成功结果。但是,该页面没有显示在 Confluence Wiki 页面上。
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 110k 0 110k 100 149 102k 138 0:00:01 0:00:01 --:--:-- 102k
No JSON object could be decoded
知道我在此配置中缺少什么吗??。请帮忙
听起来您没有使用正确的 URL 通过 REST API 创建页面。它必须是 URL/rest/api/content/
。例如,如果要在 space 和 body This is a new page
中创建标题为 new page
的页面,则需要使用以下内容:
curl -u admin:admin -X POST -H 'Content-Type: application/json' -d'{"type":"page","title":"new page","space":{"key":"TST"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}' http://<URL>:<port>/confluence/rest/api/content/ | python -mjson.tool
我一直无法使用以下 curl 脚本创建汇合页面。
curl -v -S -u user:pass -X POST -H 'Content-Type: application/json' -d'{"type":"page","title":"TestPage","space":{"key":"Cloud"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}' https://Client.atlassian.net/wiki/display/CD/Applications | python -mjson.tool
脚本执行正常并显示成功结果。但是,该页面没有显示在 Confluence Wiki 页面上。
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 110k 0 110k 100 149 102k 138 0:00:01 0:00:01 --:--:-- 102k
No JSON object could be decoded
知道我在此配置中缺少什么吗??。请帮忙
听起来您没有使用正确的 URL 通过 REST API 创建页面。它必须是 URL/rest/api/content/
。例如,如果要在 space 和 body This is a new page
中创建标题为 new page
的页面,则需要使用以下内容:
curl -u admin:admin -X POST -H 'Content-Type: application/json' -d'{"type":"page","title":"new page","space":{"key":"TST"},"body":{"storage":{"value":"<p>This is a new page</p>","representation":"storage"}}}' http://<URL>:<port>/confluence/rest/api/content/ | python -mjson.tool