Today - I had to update my API token -- and now I am getting back {"issues":[],"isLast":true} in my VBA code
Here is my code:
Public Sub TESTVBA()
Dim url As String
Dim xhr As New MSXML2.XMLHTTP60
Dim auth As String
url = "https://jciproducts.atlassian.net/rest/api/3/search/jql?jql=issuekey=GIV-177031&fields=*all"
auth = "Basic " & Base64Encode("MyEmail@domain.com:yourAPIToken")
xhr.Open "GET", url, False
xhr.SetRequestHeader "Authorization", auth
xhr.SetRequestHeader "Accept", "application/json"
xhr.SetRequestHeader "User-Agent", "PostmanRuntime/7.29.0"
xhr.Send
Debug.Print xhr.ResponseText
End Sub
Note: I have to do the User-Agent - otherwise it tells me result is not supported in the browser.
I have to use MSXLM2.XMLHTTP60 - which I hope is OK?
Hi @Chris DeNardis ,
Welcome to the community!!
It looks like your request is authenticating, but Jira is returning no visible matching issues rather than an error. In Jira Cloud, issue search only returns issues the authenticated user can actually browse, so if the new API token belongs to a different Atlassian account, or that account no longer has access to project GIV, you can get back:
{"issues":[],"isLast":true}
even though the issue key exists. Atlassian’s docs also confirm that Jira Cloud basic auth should use email address + API token in the Authorization: Basic ... header, and API tokens are tied to the Atlassian account that created them.
A few things I would check:
Make sure the token was generated for the same email account you are passing into Base64Encode.
Verify that this account still has permission to view issue GIV-177031 in Jira.
Print the HTTP status code as well as the response body. If auth is wrong, you would usually expect a 401, but if auth succeeds and the user cannot see the issue, an empty result set is possible. Atlassian’s search API returns issue matches for the authenticated user’s visible issues.
Your use of MSXML2.XMLHTTP60 is fine. The User-Agent header is not really the root issue here; the more likely problem is that the new token is valid, but it is not for an account with access to that issue.
I would also slightly simplify the test by calling the issue directly instead of using search, for example:
url = "https://jciproducts.atlassian.net/rest/api/3/issue/GIV-177031"
That makes it easier to tell whether the specific issue is accessible with the new credentials. Atlassian’s v3 REST API supports direct issue retrieval as well as issue search.
And I would add status output like this:
Debug.Print xhr.Status
Debug.Print xhr.ResponseText
the code structure looks basically okay; the most likely cause is that the new API token is tied to an account that does not have permission to see that issue/project.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.