JIRA REST call via GET returns 400 response code

Balaji January 2, 2020

Hello,

 

This is the URL I am submitting via GET REST call:

 

https://mycompany.com/issues2/rest/api/latest/search?jql=project=SISBTXTRPR AND issuetype=sub-task AND status in (Open, "In Testing", "In Development", "In Review", "Ready For Testing", "In Development - Hold", "In Review - Hold", "In Testing - Hold", "Acceptance Pending")and Sprint in openSprints() order by assignee, key 




When I paste this URL in a browser, I get properly formatted JSON response. When I submit thru VBA code, I am getting 400 response. I have also submitted thru a browser REST plugin and I get proper JSON in response. I am using basic authentication like below. BTW, this is vba code:

 

Public Function ConnectToJIRA(ByRef sText As String) As Object
With JiraService
DoEvents
.Open "GET", sText, False 
.SetRequestHeader "Content-Type", "application/json"
.SetRequestHeader "Accept", "application/json"
.SetRequestHeader "Authorization", "Basic " & UserPassBase64
.Send ""

If .Status = "401" Then
MsgBox "Not authorized or invalid username/password"
Else
End If

logFile.WriteLine "JSON Response" + vbCrLf + "=============" + vbCrLf + JiraService.ResponseText
Set JSONObj = JsonConverter.ParseJSON(JiraService.ResponseText)
Set ConnectToJIRA = JSONObj
End With
End Function

Public Function UserPassBase64() As String
Dim objXML As MSXML2.DOMDocument
Dim objNode As MSXML2.IXMLDOMElement
Dim arrData() As Byte

arrData = StrConv("username:password", vbFromUnicode)
Set objXML = New MSXML2.DOMDocument
Set objNode = objXML.createElement("b64")
objNode.DataType = "bin.base64"
objNode.nodeTypedValue = arrData
UserPassBase64 = objNode.Text
End Function

Can someone tell me what is going on? Thanks.

2 answers

0 votes
Steven F Behnke
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 2, 2020

Can you provide the actual output you get from a successful and a failure ?

0 votes
Balaji January 2, 2020

So, after further troubleshooting, somehow strangely it is not liking these items:

 

 "In Testing", "In Development", "In Review", "Ready For Testing", "In Development - Hold", "In Review - Hold", "In Testing - Hold", "Acceptance Pending"

 

These are in quotes because there are two separate words. It used to work just fine until one day it decided to stop working.

 

Does anyone know how to fix this issue?

Suggest an answer

Log in or Sign up to answer