Add attachment service to jira is rejecting the request .

harish kumar April 10, 2017

I am hitting the add attachment rest service  from my application. The request is getting failed with below exception.

* Error mapping incoming response to .response_POST: com.fasterxml.jackson.databind.JsonMappingException: Can not instantiate value of type [map type; class java.util.LinkedHashMap, [simple type, class java.lang.Object] -> [simple type, class java.lang.Object]] from String value ('1.0'); no single-String constructor/factory method
at [Source: "1.0" encoding="UTF-8" standalone="yes"?><status><status-code>500</status-code><message>org.apache.commons.fileupload.FileUploadException: the request was rejected because no multipart boundary was found</message><stack-trace>java.lang.RuntimeException: org.apache.commons.fileupload.FileUploadException: the request was rejected because no multipart boundary was found
at com.atlassian.plugins.rest.common.multipart.fileupload.CommonsFileUploadMultipartHandler.getForm(CommonsFileUploadMultipartHandler.java:75)
at com.atlassian.plugins.rest.common.multipart.jersey.MultipartFormMessageBodyReader.readFrom(MultipartFormMessageBodyReader.java:36)
at com.atlassian.plugins.rest.common.multipart.jersey.MultipartFormMessageBodyReader.readFrom(MultipartFormMessageBodyReader.java:25)
at com.sun.jersey.spi.container.ContainerRequest.getEntity(ContainerRequest.java:490)
at com.sun.jersey.spi.container.AdaptingContainerRequest.getEntity(AdaptingContainerRequest.java:236)
at com.atlassian.plugins.rest.common.multipart.jersey.MultipartFormDispatchProvider$1.getInjectableValues(MultipartFormDispatchProvider.java:57)

2 answers

0 votes
Sam Hall
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 10, 2017

Hi Harish - Welcome to the community.

Since your question is development related, you can also try asking this over at: https://community.developer.atlassian.com (if you haven't already).

You can read more about the Developer Community in this article: https://community.atlassian.com/t5/Feedback-Forum-articles/The-Atlassian-Developer-Community/ba-p/459061

0 votes
harish kumar April 10, 2017

Request generated is below

 

No Title
POST /rest/api/latest/issue/PHOENIX-38/attachments HTTP/1.1
Accept: */*
Content-Type: multipart/form-data;
boundary="----=_Part_12_735637161.1491473890117"
X-Atlassian-Token: no-check
Content-Length: 407
Host: jirapegaintegration.atlassian.net:8888
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_111)
Accept-Encoding: gzip,deflate
Authorization: Basic YW5pbHZhbmFwYXJ0aGlAZ21haWwuY29tOnBlZ2FydWxlcw==

------=_Part_12_735637161.1491473890117
Content-Disposition: form-data; name="PostData"

{"fields":{"summary":"up dtaedfrom RTA Integration","issuetype":{"name":"Bug"},"file":"Hello.txt","project":{"key":"PHOENIX"}}}
------=_Part_12_735637161.1491473890117
Content-Type: text/plain
Content-Disposition: form-data; name="file"; filename="Hello.txt"

one
------=_Part_12_735637161.1491473890117--

Suggest an answer

Log in or Sign up to answer