【发布时间】:2017-09-02 14:18:30
【问题描述】:
我想使用 REST 将附件上传到 Jira Service Desk 工单。
我明白,为了做到这一点,我首先必须上传一个临时附件,如果该响应正常,我可以使用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,Accept=application/json,null,null,null,X-Atlassian-Token=nocheck,null,null,null,null,null,null,Content-Type=multipart/表单数据]
可能是什么问题?
【问题讨论】:
标签: java rest jira-rest-api multipartentity