How to get current issueKey

Hi guys,
I’m new on Atlassian and I wrote a translation app for issues. What’s missing is the Issue key. So far it’s hardcoded and I’d like to retrieve the Issue key as soon as the user clicks on the issue. I’ll share a code example of mine.

// get current issue from atlassian
      httpClient.get('https://translate-app.atlassian.net/rest/api/2/issue/TA-3?fields=summary,description', 
        function (err, res, body) {
          const issue = JSON.parse(body);
          setLanguage(countryCode, issue)
      })

As you can see issue TA-3 is mentioned but it supposed to be a variable which get the current IssueKey automatically of course.
I hope someone can help me out here.
Thanks in advance
Best regards Peter

Hi @PeterStben,

What about using the Forge Issue Translation app for this. The link is to the source code directly and you can either use it as-is or update the source code to match your precise use case. The logic for the issueKey selection is in the index.jsx file.

Please also note that this is a Forge app, more info about Forge can be found here: https://developer.atlassian.com/platform/forge and the repository readme also has all the required steps to get started with it.

Cheers,
Caterina

1 Like

Hi,
sorry but that doesn’t answer my question at all :D.
useProductContext() doesn’t work on jira.

What I’ve found out is that there’s a getIssueContext() function what might give me the IssueIdorKey but it throws me an error its not defined ;D

And I’m well aware of the fact that there’s an issue translator app in forge and I used it but the api doesn’t work how it should after adaption.
here you can take a look.