我试图按照远程API文档中给出的指南将.xls文件上传到Confluence Wiki页面:
https://developer.atlassian.com/confdev/confluence-server-rest-api/confluence-rest-api-examples#ConfluenceRESTAPIExamples-Uploadanattachment
我省略了Python -mjson.tool,因为它显示“无法解码JSON对象”,而我没有发布JSON,所以这不合理。
然而,上述curl命令对我来说不起作用。我在控制台上看到目标页面的HTML,并且文件没有上传成功。我尝试了多种修改curl命令的方法,但都没有成功。
另外,我正在尝试上传的页面URL没有任何contentID,正如文档中建议的那样。目标URL是一个接受附件并显示已上传文件列表的页面。
请问有谁能指出我哪里错了?我对Curl没有太多经验。
curl -v -S -u admin:admin -X POST -H "X-Atlassian-Token: nocheck" -F "file=@myfile.txt" -F "comment=this is my file" "http://localhost:8080/confluence/rest/api/content/3604482/child/attachment" | python -mjson.tool
这是我正在做的事情:
curl -v -S -u username:password -X POST -H "X-Atlassian-Token: nocheck" -F "file=@/path/to/local/excelsheet.xls" https://<Confluence server>/display/page
我省略了Python -mjson.tool,因为它显示“无法解码JSON对象”,而我没有发布JSON,所以这不合理。
然而,上述curl命令对我来说不起作用。我在控制台上看到目标页面的HTML,并且文件没有上传成功。我尝试了多种修改curl命令的方法,但都没有成功。
另外,我正在尝试上传的页面URL没有任何contentID,正如文档中建议的那样。目标URL是一个接受附件并显示已上传文件列表的页面。
请问有谁能指出我哪里错了?我对Curl没有太多经验。
curl -v -S -u username:password -X POST -H "X-Atlassian-Token: nocheck" -F "file=@test.txt" -F "comment='this is my file'" "http://<confluence server>/confluence/rest/api/content/889912330/child
- m.wasowski