How to add attachment to Jira using REST API in WinDev?

Good morning all,
I’ve been on this problem for days and can’t find a solution.
I am using the Rest API to chat with Jira (Atlassian) and would like to attach a file on an “issue”. I read the doc correctly, I tried my query on PostMan and it works but I cannot find the right functions on WinDev.

Here is my actual code :

MaReq.URL = "https://karinehoubrix.atlassian.net/rest/api/2/issue/SYN-30/attachments"
MaReq.Header["Authorization"] = "Basic ****"
MaReq.Header["Accept"] = "application\json"
MaReq.Header["X-Atlassian-Token"] = "no-check"
MaReq.ContentType = "multipart/form-data; boundary=""MyBoundary"""
MaReq.Method = httpPost

MaReq.Header["Content-Disposition"]= "form-data; name=""file""; filename=""C:/Users/karine.houbrix/Pictures/test.png"""

//bufFichier est un Buffer
//bufFichier = fChargeBuffer("C:/Users/karine.houbrix/Pictures/test.png")
//MaReq.Content = bufFichier

Reponse = RESTSend(MaReq)

IF ErreurDétectée THEN
Error(ErrorInfo(errFullDetails))
ELSE
Info(Reponse.CodeEtat)
//Trace(MaReq.Contenu)
Trace(Reponse.Contenu)
END

Right now, I have the error 400. Thank you for your help :slight_smile:

Hi @KarineHoubrix,

I’m not familiar with WinDev, but I suggest inspecting the difference between the HTTP POST messages you are sending from WinDev and PostMan.

Regards,
Dugald

Hi,
I’m looking and the only difference, it’s the “content-disposition” but I can’t find how to add this information in WinDev