我尝试使用其余的api
将附件上传到Jira我尝试过以下代码:
String pathname ="C:\\Users\\Desktop\\Tool\\sample.png";
BASE64Encoder base = new BASE64Encoder();
String encoding = base.encode("test:test".getBytes());
HttpPost postRequest = new HttpPost("https://localhost:8080/rest/api/2/issue/T-6279/attachments");
File fileUpload = new File(pathname);
HttpClient httpClient = HttpClientBuilder.create().build();
postRequest.setHeader("Authorization", "Basic " + encoding);
postRequest.setHeader("X-Atlassian-Token", "nocheck");
MultipartEntityBuilder entity = MultipartEntityBuilder.create();
entity.addPart("file", new FileBody(fileUpload));
postRequest.setEntity(entity.build());
HttpResponse response = httpClient.execute(postRequest);
System.out.println(response);
我得到这个错误
你能帮我解决这个错误吗?