HAPI

What is HAPI?

HAPI is an API (application programming interface) for doing common tasks in Jira, such as:

  • Managing issues, including creating, updating, and transitioning issues
  • Updating fields, including text fields, versions, and users
  • Running JQL queries
  • Adding links
  • Adding attachments

HAPI is compatible with Jira Software and Jira Service Management (JSM).

It is not a new programming language - it is plain Groovy. It's a simpler alternative to Jira's regular API. We want any user to be able to use HAPI. Whether you’re a complete beginner or an experienced developer, HAPI is for you and your business. HAPI increases productivity and efficiency by allowing you to create automations and customizations faster than ever.

So what does the H stand for in HAPI? Well, it can be many things. Here are some of our favorites:  Happy/Hero/ Helpful/Handy/Hardworking/Harmonious/Heavy lifting.

Visit https://www.scriptrunnerhq.com/hapi to find out more about HAPI.

Why

As the Jira API has become more complex and targeted toward professional app developers, we have decided that this is the right time to introduce a simpler API. 

Tasks that should be easy, such as creating an issue, currently require 20 or 30 lines of code. This is a problem because the more code you need to write, the more bugs there are, and the more difficult the script is to read. With HAPI, the time you spend creating scripts will be greatly reduced!

Features

  • Simple and intuitive API that simplifies tasks commonly needed to automate and extend Jira.
  • Interoperable with the Jira API. You can mix and match HAPI calls with the Jira API.
  • Good integration with the in-app editing experience—for instance, completions for methods and for string parameter values, such as Priorities, Resolution names, etc.
  • Respects permissions of the current user by default, but provide the option to both override those permissions or execute as an arbitrary user.
  • Compatibility with static type checking.
  • Behaves the same as when you are using the Jira user interface. If you are permitted to do something in Jira, you have the same permissions with HAPI. 
  • Improved readability due to expressive code that allows you to do more with much less.

Unfortunately, we can't promise never to change HAPI—such a promise does not align with the key goal of being compatible with the Jira API. If the Jira API changes substantially, e.g. in Jira 10, HAPI may need to change too.

Completions

When using HAPI you'll notice helpful completions. We've developed completions to make your scripting experience even easier. For example, you don't have to remember or search for project keys; HAPI provides you with a list of project keys. The same goes for many other options you previously had to search for or remember. Give HAPI a go and see how many helpful completions there are! 

GIF displaying completions for HAPI

Keyboard shortcut

You will find the keyboard shortcut Control + Space very useful when using HAPI. This shortcut allows you to display completions when they disappear. There are a number of reasons you could want to display completions again. For example:

  • You’ve started typing and selected the wrong value, so you go back and delete some text and completions no longer display.
  • You’ve clicked out of the script console and when you return completions no longer display.
  • You’ve deleted a chosen option in a string and want to see what all of the options were again.

We also list more keyboard shortcuts within ScriptRunner. You can find these in the script console in the Documentation and Tips section.

Snippets

We've updated snippets to include HAPI code samples, that way you can get started with just a click! We've added the snippets you will find the most useful. 

GIF displaying snippets for HAPI  

Library

We've updated a number of Library scripts to include HAPI methods. If you have used any of these Library scripts in the past, you'll notice they're shorter and easier to understand because of HAPI.

Javadocs

See our Javadocs for a full list of HAPI classes and API methods.

What's next?

Create an issue with HAPI and see how easy it is to use!

If you notice something missing, let us know.

On this page