我正在尝试按照远程 API 文档中给出的指南将 .xls 文件上传到 Confluence wiki 页面: https ://developer.atlassian.com/confdev/confluence-server-rest-api/confluence-rest-api-示例#ConfluenceRESTAPIExamples-Upload anattachment
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没有太多经验。