How best to store our data in customers issue? How to get issue ID for use with API?

Hey there!

I’m currently working on my first JIRA plugin. I’m hoping to add some custom data that the user inputs via our custom web panel.

For more context: my current high-level plan is to ask the user to paste in a URL from our service into a form field, click done, I’ll then get the issue number, use the api to add a custom piece of data to the issue, and then on subsequent loads, I’ll be checking with the API if that data is there. Essentially I want to treat the users jira instance as the persistent data store.

So, is this sensible? How can I get the issue ID? Do I have to build my own input field or can I somehow declare to JIRA that installing my plugin means that all issues now have a “MyCompany Resource URL” field on issues that I could read from instead?

Any guidance would be awesome! Between cloud and server plugins, the new issue views, ACE, Alaskit, I’m well and truely confused how best to make plugins :frowning:

Thanks,
Sam

Answering part of my own question here:
You can get the key via this method
https://developer.atlassian.com/cloud/jira/platform/jsapi/context/

BUT THE EXAMPLE IS WRONG

The structure of the object is different, and if you break on response, you can see the real structure. This worked for me:

AP.context.getContext(function(response){
    console.log("Jira Issue Key", response.jira.issue.key);
  });