Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Error attack document with rest api

ese_tio September 9, 2024

 

 

Hello!!

I'm making a call to the Atlasian service to attach a file to a ticket, but I can't get it to do it correctly. 
This is the data I am sending:

Url: https://myDomain/rest/api/2/{myTicket}/attachments

Captura de pantalla 2024-09-09 120719.png


The headers i send are these:

Captura de pantalla 2024-09-09 120900.png

I used SpringBoot and feignClient and the error it is giving is:

Error statys: 500
Message: the request was rejected because no multipart boundary was found


Does anyone khnow how to resolve this error??

Thanks!!!!
 

 

 

2 answers

1 accepted

0 votes
Answer accepted
ese_tio September 10, 2024

I have found the solution :) I needed to modify the call this way:

@PostMapping(value = "/rest/api/2/issue/{issueIdOrKey}/attachments", consumes = "multipart/form-data")
Response attachFile(@RequestPart("file") MultipartFile file,
@PathVariable("issueIdOrKey") String issueIdOrKey,
@RequestHeader("Authorization") String authorization,
@RequestHeader Map<String, String> headers);

 

and configure the headers like this:

final Map<String, String> headers = new HashMap<>();
headers.put(ACCEPT, MediaType.MULTIPART_FORM_DATA_VALUE);
headers.put(X_ATLASSIAN_TOKEN, NO_CHECK);

 

 

0 votes
Marc - Devoteam
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.
September 9, 2024
ese_tio September 10, 2024

Thanks @Marc - Devoteam but it doesn't fit the technology I'm using

Suggest an answer

Log in or Sign up to answer