I’d like to link to an issue from my app, which uses OAuth2. To do this, I think I need the base URL.
Per the docs, the API does not return the base URL, but says the following:
That example uses the base url that I’m trying to get How can I get that endpoint using OAuth2? Per the docs:
Requests that use OAuth 2.0 authorization code grants are made via api.atlassian.com (not https://your-domain.atlassian.net ). Construct your request URL using the following structure: https://api.atlassian.com/ex/jira/{cloudid}/{api}
The accessible resources returns a name field, but per the docs:
Note that the name property in the response does not always correspond to the base URL of the site, even though it looks similar. It is only suitable for display to users.
Given the api.atlassian.com hostname, is there a way to get the baseUrl?
Apologies, the error message “OAuth 2.0 is not enabled for this method.” isn’t super useful. You can also make unauthenticated requests via https://api.atlassian.com, so to get the serverInfo for @nmansilla’s site (which has a cloud id of 4ce3c724-3201-4adf-b441-be21797af3a5), you could use:
Without an Authorization header (supplying one triggers the OAuth2 error you saw). Simply substitute 4ce3c724-3201-4adf-b441-be21797af3a5 with the Cloud ID of the site you’re trying to determine the base url of.