Have an API endpoint like the /search endpoint of jira but with the possiblity to add a scriptrunner enhanced search query in the JQL parameter.