JIRA REST API attach .txt file to an issue - VB

LostInMadness Forever November 27, 2019

Hi, 

 

I found a lot of topic on this issue but i am style lost..

I login correctly first of course.

I got this ansmwer : 

Status : 200
Réponse : []

 

Here is my code :

 

*********************************************************************************************

*********************************************************************************************

file= "C:\Users\Guile\Documents\file.txt"


url = urlBase & "api/2/issue/" & IssueID & "/attachments"
oRequest.Open("POST", url)

oRequest.setRequestHeader("X-Atlassian-Token", "no-check")

oRequest.setRequestHeader("Content-Disposition", "form-data; name = ""file""; filename = file.txt""")

oRequest.setRequestHeader("Content-Type", "multipart/form-data; boundary=21b8f440a67b603ac60941ee")

oRequest.Send(file)

File = Nothing
oRequest = Nothing

 

Thx a lot for your help, I am really lost..

2 answers

1 accepted

0 votes
Answer accepted
Warren
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.
November 27, 2019

Hi @LostInMadness Forever 

I know it's C#, not VB, but I successfully used the answer from Jeff Caron in this StackOverflow  article, possibly it can help if you look at the differences between your code and what's there

LostInMadness Forever November 27, 2019

Ok thank you for this link, i didn't know him.

Except that.. i dont speak c# :(

But i will try to find my probleme with this. Thx a lot panoramix.

0 votes
LostInMadness Forever December 2, 2019

any solution ? 

 

here is my code to upload an image.. i got 415 status, meaning bad content-type

of course, i longon first using "auth/1/session"

 

here to upload..

file = "C:\Users\User\Documents\file.jpg"

oRequest.Open("POST", jiraURL)
oRequest.SetRequestHeader("X-Atlassian-Token", "no-check")

oRequest.SetRequestHeader("Content-Disposition", "form-data; name=""file""; filename=""file.jpg""")
oRequest.SetRequestHeader("Content-Type", "image/jpeg; boundary=WebKitFormBoundaryE19zNvXGzXaLvS5C")

oRequest.Send(file)

Suggest an answer

Log in or Sign up to answer