I’m using Jira Cloud REST API to get a summary of a given issue, authorizing users via OAuth 2.0.
For example, to get all fields of issue “PROJ-35” I’m calling https://api.atlassian.com/ex/jira/<cloud_id>/rest/api/2/issue/PROJ-35.
My problem is that I also need to provide an absolute URL of the issue, pointing straight to Jira website (e.g. https://<my_company>.atlassian.net/browse/PROJ-35).
Is there a way to get the Jira hostname, or just the portion I’m missing, somehow via REST API?
For Jira Data Center/Server this is not an issue, as REST API are called on the very same hostname as Jira website.
In addition to what @HelenOBoyle has advised, you can do also a lookup of the Issue via the Get issue endpoint, and the response contains the self object, which is the absolute path to that Issue.
Accessing an Issue directly via the absolute path is a better method than browsing for it via the {yourCompany}.atlassian.net/browse/{issueIdOrKey} technique.
Hi @martin.peverelli,
the solution proposed by @HelenOBoyle should do for you: /rest/api/<version>/serverInfo returns your Jira instance’s base URL as displayUrl, so you can compose the Jira issue URL as <displayUrl>/browse/<issueIdOrKey>.
It’s still an additional API request call to be made, but if you’re unable to retrieve that piece of information elsewhere (like in my case, where I had to save the base URL to DB for other reasons) I guess it’s the most reliable solution.