How create link with Issue ID in Web Item?

Hi!
I created simple endpoint for generate PDF. It works, but I wanna send Issue ID to this API when I click the web-item button on Issue page , ex. (I am in Issue page with ID 123) /rest/example/1.0/export/pdf?id=123

It is possible to do that?

Now It looks something like that:

  <web-item key="export-issue-pdf" name="Export PDF" section="jira.issue.tools" weight="200">
      <label>PDF</label>
      <link linkId="export-issue-pdf">/rest/example/1.0/export/pdf</link>
  </web-item>

You should be able to use a magic property in the web-item, if you are on the issue view. If you look at this example (taken from the Jira source code), you will see that you can use ${issue.id} in the link:

    <web-item key="add-attachments-link" i18n-name-key="webfragments.view.issue.attachments.create" name="Create an Attachments" section="com.atlassian.jira.jira-view-issue-plugin:attachmentmodule/header" weight="1">
        <label key="admin.issue.operations.plugin.attach.file.name"/>
        <tooltip key="admin.issue.operations.plugin.attach.file.name"/>
        <styleClass>issueaction-attach-file aui-icon aui-icon-small aui-iconfont-add issueaction-aui-icon</styleClass>
        <link linkId="add-attachments-link">
            /secure/AttachFile!default.jspa?id=${issue.id}
        </link>
        <condition class="com.atlassian.jira.plugin.webfragment.conditions.CanAttachFileToIssueCondition"/>
    </web-item>
2 Likes