Jira has Capabilities

Reading Time: < 1 minute

A while back we were working on improving the performance of the Createmeta REST endpoint. The endpoint was deprecated and we added two new endpoints. But obviously, we couldn't remove the old one right away since that would break the API. The problem was the products (Confluence, Bitbucket, other third-party apps etc.) that integrate with Jira. They are more or less agnostic with regards to Jira versions when they are integrated, meaning they work with a range of Jira versions instead of a one to one version match.

Since we wanted customers to see improvement as soon as possible, the change was released with Jira 8.4. We needed to give the integrated products a way to check whether the new and improved endpoints are available for them to use. After some digging, we found the solution we were after was already available: the capability module.

The Capability module in Atlassian plugins is a very simple module with two fields: name and url. When you create a capability module, it is registered and when the /rest/capabilities endpoint is called the capability you created is returned. The answer of the capabilities endpoint responds with a list of JSON objects. A single entry will look like this:

"list-project-issuetypes": "http://localhost:8080/jira/rest/api/2/issue/createmeta/{projectIdOrKey}/issuetypes?startAt=0&maxResults=50"

In a Jira plugin, you can add new capabilities in the atlassian-plugin.xml. In order to get the above entry in the response, you would need to add the following capability module:

    <capability key="list-project-issuetypes">
        <name>list-project-issuetypes</name>
        <url>/rest/api/2/issue/createmeta/{projectIdOrKey}/issuetypes?startAt=0&amp;maxResults=50</url>
    </capability>