使用带有 cURL 的 Jira REST API 上传 .zip 文件

Using the Jira REST API with cURL to upload .zip file

所以我尝试将 .zip 文件上传到 Jira rest API,但我收到错误 415 不支持的媒体类型。

我尝试过的:

curl -D- -u $username:$password -X POST -H "X-Atlassian-Token: no-check" -H "Content-Type:application/zip" -F "file=@result.zip" $myURL/rest/api/2/issue/QTC-12/attachments

但遗憾的是这给出了 415。

这可能是由于 -H "Content-Type:application/zip" 我怀疑 Jira API 不希望将 zip 作为内容类型。

因为它正在使用 -F 选项,所以这可能是 Curl 使用的默认内容类型的一种形式,所以您是否尝试删除 zip header 和 运行 命令?

编辑: 刚看了 JIRA API https://docs.atlassian.com/software/jira/docs/api/REST/7.6.1/#api/2/issue/{issueIdOrKey}/attachments 而且是multipart/form-data类型的。 API 上的示例没有显示其他内容类型 header。