使用休息将附件上传到JIRA服务台



我想使用REST上载附件到JIRA服务桌票。我知道,要首先要执行此操作,我必须上传临时附件,如果该响应还可以,我可以使用temporaryAttachmentId将附件上传到机票。

我的问题是我有以下错误:

HttpResponseProxy{HTTP/1.1 415 Unsupported Media Type [Server: Atlassian Proxy/XXX, ATL-vTM-Backend-Time: XX, Content-Type: text/html;charset=UTF-8, Strict-Transport-Security: max-age=XXX; includeSubDomains; preload, Date: XX, X-AREQUESTID: XX, ATL-vTM-Time: XX, X-AUSERNAME: XXXX, X-Content-Type-Options: nosniff, Connection: keep-alive, Set-Cookie: atlassian.xsrf.token=XXXX|lin; Path=/; Secure, X-Seraph-LoginReason: OK, Content-Length: 0, ATL-vTM-Queue-Time: 0] [Content-Type: text/html;charset=UTF-8,Content-Length: 0,Chunked: false]}

我的代码看起来像这样(URL是有效的URL,并且文件存在):

  HttpPost httpPost = new HttpPost(url);
  processHttpEntityEnclosingRequestBase(httpPost, headers);
  MultipartEntity entity = new MultipartEntity();
  entity.addPart("file", new FileBody(new File(file.getAbsolutePath())));
  httpPost.setEntity(entity);
  HttpResponse responsePut = httpclient.execute(httpPost);

我的标题:[授权=基本xxxxxxx,null,null,null,null,accept = application/json,null,null,null,null,x-atlassian-token = nocheck,null,null,null,null,null,null,null,null,null,null,null,content-type = multempart = muttipart/yrouptArt/form-data]

有什么问题?

只是一个粗略的猜测:您的标题接受应用程序/json,但在错误响应中,内容类型为文本/html。也许是问题。

最新更新