How can I programmatically get the Jira server version or installed plugin versions?

I’d like to report the Jira server version back to my app. Is that available via the Java API?

Lots of mindless searching leads me here: ServerInfoResource (Atlassian JIRA - Server 8.4.3 API)

But I cannot find the classes ServerInfoResource or ServerInfoBean in any of the public API JARs. Are these available somewhere?

I would also be interested in getting plugin versions programmatically, if possible.

If you want the Jira Server/DC version, you can use com.atlassian.jira.util.BuildUtilsInfo. This is available for injection into your class.

To get the version of a plugin, you can use com.atlassian.plugin.PluginAccessor, which is also available for injection.

You can either loop over all installed plugins using PluginAccessor.getPlugins(), or if you have the key, retrieving it directly:

Plugin plugin = pluginAccessor.getPlugin(key);
if(plugin != null) {
  String version = plugin.getPluginInformation().getVersion();
}

@remie thank you.

As a practical matter, how does a plugin developer find this stuff? Just surfing the massive javadoc? Are there example plugins out there? The tutorials are not that useful for exploring the java API.

Thanks again!

It’s a combination of http://docs.atlassian.com, google, java docs, tutorials, Atlas Camp presentation… nah, who am I kidding: the only reliable way to understand what is going on in Server land is the host product source code. You get access to the sources of all Atlassian products with a starter license. It’s the best $10,-- investment you can make.

1 Like

You forgot my favorite service there is:

No need to deal with keys.