I am trying to create an automated service for Jira where a zip file or .db3 file is uploaded to an existing Jira issue. This is my current code:
var client = new RestClient(".../rest/api/3/issue/"+issueKey);
client.Timeout = -1;
var request = new RestRequest(Method.PUT);
request.AddHeader("Authorization", "Basic ...");
request.AddHeader("X-Atlassian-Token", "nocheck");
if (File.Exists(zipPath))
{
File.Delete(zipPath);
}
ZipFile.CreateFromDirectory(path, zipPath);
request.AddHeader("Content-Type", "multipart/form-data");
request.AddHeader("X-Content-Type-Options", "nosniff");
request.AddHeader("Accept", "application/zip");
request.AddFile("file", zipPath, "application/zip");
var response = client.Execute(request); When this request is sent, I receive "StatusCode: UnsupportedMediaType, Content-Type: text/html;charset=UTF-8, Content-Length: -1)" even though the content-type has been set to application/zip, I am not sure what is going wrong here. I know zip files can be uploaded directly into the issue, so it is not an issue with project permissions or custom restrictions. When adding on "/attachments" to the end of the RestClient url, MethodNotAllowed is returned or when "Content-Type" is set to "application/zip", UnsupportedMediaType is also returned. The documentation only talks about image or json files, I have have not seen anything for other file types. Any help here would be appreciated.