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
Community Members
Community Events
Community Groups

Error while changing issue status with REST API - VBA


I've been trying to change issue status and it works but while the code is still running I'm getting an error.

Error code: -2147467260

Error description: Operation failed

Error source: msxml3.dll

This the code I'm using

Public Sub setStatus(ByVal issueId As Long)
    Dim oJIRA     As Object
    Set oJIRA = CreateObject("MSXML2.XMLHTTP")
    With oJIRA
        .Open "POST", sURL & "/rest/api/2/issue/" & issueId & "/transitions", False
        .setRequestHeader "Content-Type", "application/json"
        .setRequestHeader "X-Atlassian-Token", "nocheck"
        .setRequestHeader "Accept", "application/json"
        .setRequestHeader "Authorization", "Basic " & EncodeBase64
        .send JsonFiles.readJsonFile(JsonFiles.statusSelectedToWork)
    End With
    Set oJIRA = Nothing
End Sub

 I get the error on line .send...

this is how the file looks like in the send line


 Like I said earlier the transition is successful, status changes but I have no idea where does the error come from and I don't know if it would be a good idea just to ignore it.


I tried changing oJira to CreateObject("MSXML2.ServerXMLHTTP") and it works great without that error but because of how ServerXMLHTTP works it requires authorization credentials each time unlike XMLHTTP object.

Any idea why that error pops up and how to make it work with XMLHTTP without that error?

2 answers

Ok, after doing a bit of research now I know where seems to be the problem. At first I focused too much on vba code being the culprit but as it turned out it's a bit of everything.


After sending proper JSON data to API you get no content in response and normally the status should be 204 after it updated the issue successfully.

BUT because I'm using a XMLHTTP object that uses WinInet for its functionality (unlike ServerXMLHTTP) IE isn't handling very well a response without content and it gives a status 1223. So that's the first unexpected result.

Another is that XMLHTTP can't handle properly "no content" response and that's why VBA code stops and throws msxml3.dll error.


This error can happen in every "no content" response method in jira rest api using XMLHTTP object. There would be no problem if we received a simple JSON content in return. Other than that as far as I know there is no "nice" fix for if except a simple workaround like "on error resume next" and check if that's the error we expected and replace status 1223 with 204 to keep it "as it should be" :)

0 votes

You can fix the problem with using code:

Set xmlhttp = CreateObject("WinHttp.WinHttpRequest.5.1")

issue = "{""fields"":{""summary"": ""text""}}"

xmlhttp.Open "put", url, False
xmlhttp.setRequestHeader "Authorization", "Basic " & EncodeBase64
xmlhttp.setRequestHeader "Accept", "application/json"
xmlhttp.setRequestHeader "Content-type", "application/json"
xmlhttp.setRequestHeader "X-Atlassian-token", "no-check"
xmlhttp.Send issue
result = xmlhttp.responseText
statusHml = xmlhttp.Status

Suggest an answer

Log in or Sign up to answer