You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.