【发布时间】:2017-05-23 15:56:13
【问题描述】:
我想使用 VBA 和 Excel 在 JIRA 中自动生成 Excel 报告,我正在尝试使用 VBA 访问 JIRA 以将数据导出到 Excel。因此,我从身份验证开始,然后尝试使用此代码导出数据:
Private JiraService As New MSXML2.XMLHTTP60
Private JiraAuth As New MSXML2.XMLHTTP60
Sub JIRA()
With JiraAuth
.Open "POST", "https://jiralink/rest/auth/1/session", False
.setRequestHeader "Content-Type", "application/json"
.setRequestHeader "Accept", "application/json"
.send " {""username"" : """username""", ""password"" : """password"""}"""
MsgBox .Status
If .Status = "200" Then
sCookie = "JSESSIONID=" & Mid(sErg, 42, 32) & "; Path=/" & sPfad
Login = True
End If
End With
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;https://jiralink/sr/jira.issueviews:searchrequest-excel-all-fields/temp/SearchRequest.html?jqlQuery=project+%3D+NAME+AND+Sprint+%3D+1+ORDER+BY+priority+DESC%2C+updated+DESC&tempMax=1000" _
, Destination:=Range("$A$1"))
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.BackgroundQuery = True
.RefreshStyle = xlInsertDeleteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.WebSelectionType = xlEntirePage
.WebFormatting = xlWebFormattingNone
.WebPreFormattedTextToColumns = True
.WebConsecutiveDelimitersAsOne = True
.WebSingleBlockTextImport = False
.WebDisableDateRecognition = False
.WebDisableRedirections = False
.Refresh BackgroundQuery:=False
End With
End Sub
我收到错误:403 禁止 谁能帮帮我? 抱歉,我是 VBA 和 JIRA 的新手
【问题讨论】:
-
您是否在
send请求中输入了正确的用户名和密码?同样,仅仅因为您已通过 Web 服务登录 JIRA 并不意味着查询连接提供了正确的登录凭据。 -
感谢您的重播@Scott Holtzman,是的,用户名和密码正确
-
我想连接到我的 JIRA 帐户,然后访问允许我将数据导出到 Excel 的 URL jiralink/sr/jira.issueviews:searchrequest-excel-all-fields/temp/…>
标签: vba excel jira jira-rest-api