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

Karine Houbrix
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 10, 2020

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 aG91YnJpeC5rYXJpbmVAZ21haWwuY29tOkRyaVl2UWRBZDlHR2RzYTRlZ2Q2MEMwNg=="
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 :)  

2 answers

1 accepted

0 votes
Answer accepted
Petter Gonçalves
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 11, 2020

Hello @Karine Houbrix

Welcome to the Atlassian Community!

Since you are asking for help with an integrated development environment (WinDev), I suggest reaching out in our Atlassian Developer Community:

https://community.developer.atlassian.com/ 

The mentioned portal was specifically created for development questions, where you will find articles and suggestions from other third-party partners and Atlassian developers. Feel free to open a new topic about your question there! :)

Let us know if you have any other questions.

0 votes
Qautomation March 29, 2023

For UFT integration with Xray-JIRA with attachment :

https://q-automations.com/2020/04/03/uft-integration-with-xray-jira/

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events