Find out current version - API/JSON/RSS
Asked by Sinan Polat:

I have Confluence (and actually more Atlassian products) running on my server. I want to easily - using a script - read out which version of Confluence is currently running.

I can do that by browsing to the login page and extract it from the HTML code, but perhaps there is a better way to do it?

Does Confluence by default expose a RSS/JSON feed?


Answers:
author: Stephen Sifers
body: Hello Sinan,

There is an API call which will return system information for the Confluence server. The result will also be in a JSON format which will make parsing it out much easier.

Here is an example:

curl -u user:password -X GET <http://confluence.server.com/rest/applinks/1.0/manifest>

Result:

```
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<manifest><id>0000000-0000-0000-0000-0000000000000</id>
<name>Confluence</name>
<typeId>confluence</typeId>
<version>6.13.0</version>
<buildNumber>9942</buildNumber>
<applinksVersion>0.0.0</applinksVersion>
```

Alternatively, there is a simple un-authentication solution to getting the version. If you simply run a CURL call again Confluence, it will return its version within the results.

Example:

CURL <https://confluence.server.com/rest/api>

Results:

```
<...>
<li class="print-only">Printed by Atlassian Confluence 6.13.0</li>
<...>
```

From the results, you could write a script to parse out the version.

This should get you the version for Confluence.

Regards,  
Stephen Sifers

comments: author: Sinan Polat
body: <http://confluence.server.com:9000/rest/api> returns a Page not found, I am running v6.7.1.

Browsing to the login page returns:

```
<meta name="ajs-version-number" content="6.7.1">
```

I haven't checked the other Atlassian products yet, but I am trying to find 1 way to find out the version (unauthenticated).


author: Stephen Sifers
body: Hello again Sinan,

I just retested this on Confluence 6.7.1.

Here is the CURL call:

```
curl http://MyConfluence.Server.Domain/rest/api
```

Example:

```
curl http://YourConfluence.Server.Name:9000/rest/api
```

Here is the response:

```
<...>

<li class="print-only">Printed by Atlassian Confluence 6.7.1</li>

<...>
```

This will give you a result without requiring authentication.

Regards,  
Stephen Sifers


author: Sinan Polat
body: Hi Stephen,

Oh, it indeed shows the version, but still it is a Page not found page, so I could use any url?

```
[root@mail ~]# curl http://url:9000/rest/api|grep -i "print-only\|page not"
 % Total % Received % Xferd Average Speed Time Time Time Current
 Dload Upload Total Spent Left Speed
 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 <title>Page Not Found - Confluence</title>
100 24790 0 24790 0 0 289k 0 --:--:-- --:--:-- --:--:-- 291k
 Page Not Found
 <li class="print-only">Printed by Atlassian Confluence 6.7.1</li>
[root@mail ~]#
```

Do you know if this also works for Jira/BitBucket/and other Atlassian products?

Thanks!


author: Stephen Sifers
body: Hello again Sinan,

The REST API call is to a page that is not present, thus the page not found. We're parsing out the footer through a bad REST API call. It's not elegant, but it gets you the version you need.

For Jira it will display:

```
<span id="footer-build-information">(v7.12.3#712004-<span title='5ef91d760d7124da5ebec5c16a948a4a807698df' data-commit-id='5ef91d760d7124da5ebec5c16a948a4a807698df}'>sha1:5ef91d7</span>)</span>
```

For Bitbucket it will display:

```
<li>Atlassian Bitbucket <span title="bd5e9b4d8c6186686fa94a23777fe3adbc0bc81f" id="product-version" data-commitid="bd5e9b4d8c6186686fa94a23777fe3adbc0bc81f" data-system-build-number="bd5e9b4"> v5.15.0</span></li>
```

I hope this is helpful.

Regards,  
Stephen Sifers


Tags: confluence-server

server