There is no such Jira REST API endpoint… hence the error message.
You cannot get a user’s teams via Jira’s REST API, you must use the Teams REST API, as you’ve already discovered.
Also, you said:
i think i will use
const response = await requestJira(gateway/api/public/teams/v1/org/${orgId}/teams)
But that will not work, since Jira cannot access the Teams API, so Jira cannot ‘respond’ to that request. You’re confusing two different products and their two different APIs and their two different access paths.
Trust me, this question has been asked many times before and the answer is easily found by using a Google search or just searching this forum.
in teams rest api. we need org id. how do i fetch org id ?. I tried google first. i could not find the result i dont know how to get the org id. there is no google explaination for the same.
That’s odd. I did a Google search of ‘atlassian rest api get organization ID’ and got the answer, immediately and it was the very first result returned. Maybe you are using some other ‘Google’ where you are?
I think you’re just not taking the time to read the documentation properly and thoroughly and you’re making random guesses instead.
For example, you said for the Organization REST API “it required a scope”, but it doesn’t. That API doesn’t support OAuth, only Basic auth with a bearer token. This is stated right there on the Authentication page:
Authentication is implemented via an API key. Use the API Key as a Bearer access token to authenticate the script and manage your organization. The Organization ID is used as a unique identifier in the path parameter for the organization. Copy the Organization ID and API key and keep them in a safe place. We won’t show them to you again.
… so, in the absence of OAuth, there are no ‘scopes’ to use.
On that page, it also gives a link to follow to find the documentation that describes exactly how to generate the key to use the API and also get the Org ID:
All you have to do is actually read the documentation thoroughly.
Search this forum first; chances are your question has already been asked and answered already (trust me, it has!). Then try Google, as I’ve seen the same question many times over on the Community Forum, so Google will have indexed it.
You’re not wasting my time… you’re mostly wasting YOURS. When you learn to look for, find or work out the answers yourself, you break free of the cycle of constantly having to stop work, ask questions and then wait for someone else to give you an answer… maybe, sometime.