Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Error while changing issue status with REST API - VBA

Kornel I'm New Here Jul 04, 2021

Hey,

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

{
"transition":{
"id":"21"
}
}

 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?

1 answer

0 votes
Kornel I'm New Here Jul 06, 2021

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" :)

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you