使用以下命令添加附件:api / 2 / issue / {issueIdOrKey} / attachments

时间:2016-06-09 12:23:03

标签: vba rest jira

我已成功创建了Jira问题,现在想要使用以下命令添加附件:api / 2 / issue / {issueIdOrKey} / attachments

我的以下VB代码无法正常工作,请提出任何建议,因为这对我来说是新的,谢谢。我得到的错误是:HTTP状态500 - 解析Content-Type

时出错

Sub JIRA_PostAttachment()

将pHtml变暗为字符串 Dim oHttp As Object Dim strResponse As String

pHtml =“https://jira.ae.sda.corp.test.com/rest/api/2/issue/IS-163/attachments” sVar =“”“file =”“:”“C:\ Users \ c776469 \ FORM.msg”“”

Set oHttp = CreateObject("Microsoft.XMLHTTP")
Call oHttp.Open("POST", pHtml, False)
'oHttp.SetRequestHeader "Content-Type", "application/json"
oHttp.SetRequestHeader "Content-Type", "multipart/form-data;Charset=UTF-8; boundary="
'oHttp.SetRequestHeader "Accept", "application/json"
oHttp.SetRequestHeader "X-Atlassian-Token", "no-check"

oHttp.SetRequestHeader "Authorization", "Basic Yzc4NjQ3OTpHaWxpdDIwMTY/"

Call oHttp.Send(sVar)

strResponse = oHttp.ResponseText
MsgBox strResponse

Set oHttp = Nothing

End Sub

1 个答案:

答案 0 :(得分:0)

请看这个链接:

https://answers.atlassian.com/questions/39127148/answers/39127815/comments/39130956

它有一个有效的VBA示例(也是一个C#示例)