Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,559,491
Community Members
 
Community Events
184
Community Groups

JIRA REST attachement txt VB

Edited
Deleted user Nov 05, 2019

Hi,

I have found a lot of topic on this subject but i am still lose. I can't find a solution so i come here for your help.

This is my code in vb

 

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

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

Public Function jiraSendFile(user As String, password As String, id As String, fileToUpload As String)

Dim oRequest As Object
oRequest = New WinHttp.WinHttpRequest
Dim data As String
Dim response As String
Dim status As String
Dim url As String
'Dim File As String

Dim File As New StreamReader(fileToUpload)

 

 

*************************       LOGIN       *******************************************
data = "{""username"": """ & user & """,""password"": """ & password & """}"
url = "http://vld-jira:XXXX/rest/auth/1/session"
oRequest.Open("POST", url)
oRequest.setRequestHeader("Content-Type", "application/json")
oRequest.Send(data)
response = oRequest.ResponseText
status = oRequest.Status

Result.Text = "Corps : " & data & vbCrLf & "Status : " & status & vbCrLf & "Réponse : " & response
Result.Update()

 

*************************       SEND    *******************************************
'File = fileToUpload
url = "http://vld-jira:XXXX/rest/api/2/issue/" & id & "/attachments"
'oRequest.Open("POST", url, True)
oRequest.Open("POST", url)
'oRequest.setRequestHeader("Content-Type", "application/json")
oRequest.setRequestHeader("X-Atlassian-Token", "no-check")
'oRequest.setRequestHeader("Authorization", "Basic")
'oRequest.setRequestHeader("Content-Disposition", "form-data; name=""file""; filename=test.txt""")
'oRequest.setRequestHeader("Content-Type", "multipart/form-data; boundary=21b8f440a67b603ac60941ee")
'oRequest.setRequestHeader("Content-Type", "application/octet-stream")
oRequest.setRequestHeader("Content-Type", "application/txt")
'oRequest.setRequestHeader("Content-Disposition", File)
oRequest.Send(File)

 

*************************       Result       *******************************************

response = oRequest.ResponseText
status = oRequest.Status

Result.Text = Result.Text & vbCrLf & vbCrLf & vbCrLf & vbCrLf & "Corps : " & data & vbCrLf & "Status : " & status & vbCrLf & "Réponse : " & response
Result.Update()
'MsgBox(test & vbCrLf & status & vbCrLf & vbCrLf & response)

File = Nothing
oRequest = Nothing

 

Return 0
End Function

 

 

I got 415 message status or when i got 200 status, nothing is up in my jira issue.

 

Thanks a lot for your help.

0 comments

Comment

Log in or Sign up to comment
TAGS
AUG Leaders

Atlassian Community Events