How to get Jira issue id from issue key

Sarangadhar.Sahani August 18, 2019

Zephyr apis accept issueId. How to we programmatically get the corresponding issueId for an issueKey?

If we have to use combination of Jira and Zephyr apis, then how do we authenticate programmatically for Jira api calls like we do for Zephyr through JWT.

 

2 answers

2 accepted

2 votes
Answer accepted
DPKJ
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
August 18, 2019

What platform are you on?

  1. Jira server
    • You can call <JIRA_BASE_URL>/rest/api/2/issue/{issueIdOrKey}
      • This api accept issue id or key as path parameter.
    • For authentication on server platform you have two options
      1. BasicAuth (base64 encoded username and password)
      2. oAuth
    • You can read more about it here https://docs.atlassian.com/software/jira/docs/api/REST/8.3.2/
  2. Jira Cloud
    • You can call <SITE_URL>/rest/api/3/issue/{idOrKey}
      • similar to server this api also accept issue id or key as path parameter
    • For authentication on cloud platform you have two options
      • BasicAuth with API Key (base64 encoded email and api key)
      • oAuth 2.0
    • You can read more about this here https://developer.atlassian.com/cloud/jira/platform/rest/v3/
Sarangadhar.Sahani August 19, 2019

Thank you @DPKJ 

DevajeetMicrosoft August 15, 2022

I am getting 404 if I try GET/rest/api/2/issue/{issueIdOrKey} even though the issue exists for that key. Any help?

Antonio Gil Coto February 20, 2023

HI @DPKJ There is no issue.id for Jira Cloud as Smart Value

https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/

Although, following this doc https://confluence.atlassian.com/automation/find-the-smart-value-for-a-field-993924665.html, you can use the dot notation for whichever issue field ....

So now we can access Xray GraphQL API

https://xray.cloud.getxray.app/doc/graphql/addtestsetstotest.doc.html

 

Daniel Mende April 26, 2023

@DevajeetMicrosofttry /rest/api/3/issue/{issueIdOrKey}

Ladislav Prchal October 10, 2023

I retrieved some email like API 2 and 3 are being made obsolete... I wonder, is this still going to be functional? I would say it is different endpoint to Tempo, but I am not sure...

0 votes
Answer accepted
Sreenivasaraju P
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2019

Hi @Sarangadhar.Sahani ,

You can get it using REST API 

 /rest/api/2/issue/{issueIdOrKey}

https://community.atlassian.com/t5/Jira-questions/How-I-get-issue-id-of-particular-issue-in-Jira-Service-Desk/qaq-p/977378

 

If you want to get using JAVA API . You can user IssueMangaer class. From this you can get issue object using issuekey.

Sarangadhar.Sahani August 18, 2019

Thank you @Sreenivasaraju P can you help me how the authentication work for calling  atlassian apis? Does it work through JWT like Zephyr?

Suggest an answer

Log in or Sign up to answer