I am having a little trouble with something that I think should be quite simple. I've created an OAuth2 (3LO) app for Jira (on Atlassian Cloud) and have successfully connected to it with my app (i.e.: got the token and I can call the API).
I call the API to get the correct "cloudId" as the documentation states.
The user that I am authenticating with when connecting via OAuth2 is an Administrator for the Jira project that I am trying to query.
When I use this endpoint:
I get a response, but an empty one (i.e.: no projects listed):
The documentation states, as I understand it, that I should get a list of any project that the logged in user has "browse" or "administration" permissions for. My user has both.
Has anyone had a similar trouble?
Thanks in advance,
Edit: searching by a specific project key works.
So I therefore no longer think that this is a permissions issue.
Still returns an empty list of projects. I wonder if I am missing some kind of important parameter on this call?
Hi @benji78 -- Welcome to the Atlassian Community!
I just tried getAllProjects and it worked for me:
Hi @Bill Sheboy thanks for your reply.
I had not seen this documentation before, so thank you for the reference. However, is seems that this API is authenticated via OAuth 1.0a or HTTP Basic Auth? I am attempting to support OAuth 2.0.
When I call the endpoint that you cite I get all public repositories, rather then private ones that I have access to. This implies to me that the API is not using my access token to authenticate.
I also note that the API root is different. In the API that you reference it is `https://jira.atlassian.com` but in the OAuth2 API it is `https://api.atlassian.com` with the latter requiring the "cloud ID" to be present in the URL.
Using the OAuth2 API here are my results:
And the same responses from the version 3 URLs.
It seems suspicious to me that specifying `TESTJ` at the end of the URL renders a result, but leaving this out does not return all projects...
Oops! This is my fault. Thank you @Bill Sheboy for the answer and indeed you are correct that the endpoint works.
I simply had the required HTTP header set to:
> token <token>
> Bearer <token>
So muppetry on my part, but perhaps this will help someone else one day!
Catch up with Atlassian Product Managers in our 2020 Demo Den round-up! From Advanced Roadmaps to Code in Jira to Next-Gen Workflows, check out the videos below to help up-level your work in the new ...
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