How to make a macro that displays a JQL query?

I’d like to create a plugin/macro that runs a JQL query (to a connected Jira server) and displays the result. How can I do this? The macro tutorials are pretty limited :o(