How to retrieve current issue id


I have created a small test app. It contains only one web_panel with a button. I would like to retrieve id of the current issue the panel is displayed within.

Here is my panel source:

<!DOCTYPE html>
<html lang="en">
<link rel="stylesheet" href="" media="all">

<script src="" async></script>
<!-- jQuery -->
<script src="//"></script>
<!-- Atlassian User Interface (AUI) -->
<link rel="stylesheet" href="//" media="all">
<script src="//"></script>

function someTest () {
  console.log('Some test')
    url: '/rest/api/latest/expression/eval',
    type: 'POST',
    headers: { 'Accept': 'application/json' },
    contentType: 'application/json',
    data: {
      expression: 'issue.key'
    success: function (responseText) {
      console.log('Eval:', responseText)
    error: function (responseText) {
      console.log('Eval error:', responseText)

  <section id="content" class="ac-content">
      <button onclick="someTest()" target="_blank">Test</button>

But this does not work, the request returns this error:

Object { status: 400, statusText: “Bad Request”, responseText: “{“errorMessages”:[“Can not deserialize instance of out of START_ARRAY token\n at [Source: com.atlassian.plugin.connect.plugin.auth.scope.InputConsumingHttpServletRequest$1@15fc521a; line: 1, column: 1]”]}”, getResponseHeader: getResponseHeader(), getAllResponseHeaders: getAllResponseHeaders() }

The only required body parameter is “expression” according to api-rest-api-2-expression-eval-post, so why it is complaining about the missing context, which BTW I am not able to provide from my panel.

Other requests works fine such as getting current user info:

AP.request({ url: '/rest/api/latest/myself', ... }) // works fine

Am I doing something wrong or is there any better approach to retrieve the current issue id?

Thank you

Hi @KahanekAles,

Perhaps you could try AP.context.getContext(). If the panel is displayed within an issue context, then the context object should contain the issue key as per the example in the linked documentation.


Hi @dmorrow, thank you for your reply, but this does not work either. I did exactly what is in the docs:

   function someTest () {
     console.log('Some test')
       console.log("Jira Issue Key", response.issue_key);
       console.log("Confluence page id", response.pageId);
       console.log("license status", response.license);

And the result after button click was:

Jira Issue Key undefined
Confluence page id undefined
license status undefined

It seems that the context is not initialized.

Here is the content of my atlassian-connect.json file, if it helps (some sensitive values were replaced):

  "name": "TEST app",
  "description": "TEST app",
  "key": "",
  "scopes": [
  "baseUrl": "",
  "vendor": {
    "name": "Company name",
    "url": ""
  "authentication": {
    "type": "none"
  "apiVersion": 1,
  "modules": {
    "generalPages": [
        "url": "/helloworld.html",
        "key": "hello-world",
        "location": "",
        "name": {
          "value": "Greeting"
    "jiraIssueContents": [
        "icon": {
          "width": 0,
          "height": 0,
          "url": "/icon-24px.svg"
        "target": {
          "type": "web_panel",
          "url": "/mypanel.html"
        "tooltip": {
          "value": "Some tooltip"
        "contentPresentConditions": [
            "condition": "user_is_logged_in",
            "invert": false
        "name": {
          "value": "Some name"
        "key": "some-key"

Hi @dmorrow,
I have found a solution. The response contains info about current issue as folows:

  "jira": {
    "issue": {
      "issuetype": {
        "id": "10001"
      "key": "TEST-1",
      "id": "10000"
    "project": {
      "key": "TEST",
      "id": "10000"

This solves my problem now.

There is no “issue_key” field as stated in the docs.

Is the documentation outdated? Where can I find the proper information without doing endless trial and error investigation?

Thank you

1 Like