It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

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 Community Leader Nov 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

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.

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
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you