How to check if i am using community or comercial version?

Must-share information (formatted with Markdown):
SonarQube deployed: Docker
*how to check if i am using community or commercial version?
is there any api calls or command.Or is it available in any files.
I need to warn user if they are using community version.

Do not share screenshots of logs – share the text itself (bonus points for being well-formatted)!

Welcome :slight_smile:

you might use the internal web api call api/editions/show_license, see
https://<yoursonarhost>/web_api/api/editions/show_license?internal=true

The response example of the api docs has

{
  "expiresAt": "2018-01-25",
  "isExpired": false,
  "edition": "Enterprise Edition",
  "isValidEdition": true,
  "maxLoc": 500000,
  "loc": 1000,
  "serverId": "abcdefgh-12345678901234567890",
  "isValidServerId": true,
  "isSupported": true,
  "isOfficialDistribution": true,
  "type": "PRODUCTION",
  "contactEmail": "contact@sonarsource.com",
  "remainingLocThreshold": 100000
}

The community edition has no endpoint api/editions you’ll get a 404 and no response as in the example above.
Means if you get a valid response http 200 it’s commercial, if http error 404 it’s the community edition.

web api docs community edition

Gilbert

1 Like

What about Developer Edition and Data Center Edition.Did they have the api/edition end point.Also since we cannot entirely depended on the api calls 404 to identify, is there any files or any other method restriction which allow as to identify the Enterprise version.

i guess they have, i know only Community and Enterprise edition.

The edition is also seen in the footer of the web ui, but i don’t know how to extract that via script.
There is a file that is different for any edition, see $SONARQUBE_HOME/lib/scanner

i.e. for Sonarqube 10.3
Community = sonar-scanner-engine-shaded-10.3.0.82913-all.jar
Developer = scanner-developer-10.3.0.82913-all.jar
Enterprise = scanner-enterprise-10.3.0.82913-all.jar

Also every edition has a different number of bundled plugins, because the number of supported languages and features differs, see $SONARQUBE_HOME/lib/extensions i.e.
Community edition has no Python support, means no sonar-python-plugin-xxx.jar
Developer edition has Python support, but no rpg or pl1 support, means no sonar-pli-plugin-xxx.jar
and sonar-rpg-plugin-xxx.jar

1 Like

When I tried with different images community,developer,commercial provided in this page
https://hub.docker.com/_/sonarqube
I was able to get an html page as response.
https:///web_api/api/editions/show_license?internal=true was available for both community and developer.Is there any api calls?

Strange, i’ve installed Sonarqube Community edition 10.3 from zip and there was no
entry for /api/editions/show_license in the web api docs - see screenshot of my first response.

https://<yoursonarhost>/api/editions/show_license is the api call

When I tried with docker image of community and developer version, both of them produced a similar
web page response for https:///web_api/api/editions/show_license?internal=true

<!DOCTYPE html>
<html lang="en">
    </script>

    <script type="module" src="/js/outUYAEPT2H.js"></script>
<head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
</body>

</html>
    <link rel="icon" type="image/x-icon" href="/favicon.ico">
    <meta name="application-name" content="SonarQube" />
    <meta name="msapplication-TileColor" content="#FFFFFF" />
    <meta name="msapplication-TileImage" content="/mstile-512x512.png" />
    <title>SonarQube</title>

    <link rel="stylesheet" href="/js/outL6SK2UVO.css" />
</head>

<body>
    <div id="content">
        <div class="global-loading">
            <i class="spinner global-loading-spinner"></i> 
            <span aria-live="polite" class="global-loading-text">Loading...</span>
        </div>
    </div>

    <script>
    </script>
    <script type="module" src="/js/outUYAEPT2H.js"></script>
</body>

</html>

For https:///api/editions/show , both of them produced 404 response.
I am talking with respect to docker images

the correct url for the web api doc is
https://<yoursonarhost>/web_api/api/editions/show_license?internal=true

but not https://web_api/api/editions/show_license?internal=true

and for the api call you’ll also need the Sonarqube hostname, means
https://<yoursonarhost>/api/editions/show_license

instead of https://api/editions/show_license

But i think you just have forgot to format the url as code, because if not, the hostname disappears
the difference is

without formatting as code https://<yoursonarhost>/api/editions/show_license
changes to https:///api/editions/show_license

see

Did you replace <yoursonarhost> with your Sonarqube hostname ?

Sorry.When i posted here, the <yoursonarhost> got replaced.

But i tried the same way you provided and it was not returning the json file.
For https://<yoursonarhost>/web_api/api/editions/show_license?internal=true it was a website like above and for
https://<yoursonarhost>/api/editions/show_license it was 404 for both community and enterprise version.

For both the cases(community and enterprise versions) the response was same and I was not able to differentiate

Did you try it from browser in your container ?

In the browser after some time, it is showing a community edition at the bottom.But cannot depend on this as at first it is returning an html file which I have provided you earlier.

And does the api call https://<yoursonarhost>/api/editions/show_license return a json when called
from browser ?

With the Community edition you should get http error 404, as this endpoint is only available
in commercial editions.

I tried with this end point and it returns a JSON format with edition having “community” as result.
curl -u <user_name>:<password> http://localhost:9005/api/navigation/global | jq .edition
Is this a supported endpoint and is it available for enterprise and developer version.

1 Like

Good catch!!
Never used this endpoint, but it’s available for Enterprise edition - so i guess for Developer edition also.

see
https://<yoursonarhost>/web_api/api/navigation?internal=true

If possible can you sent me the JSON format when this api call is made in enterprise version?

{
	"canAdmin": true,
	"globalPages": [
		{
			"key": "governance/portfolios",
			"name": "Portfolios"
		}
	],
	"settings": {
		"sonar.lf.gravatarServerUrl": "xxx",
		"sonar.technicalDebt.ratingGrid": "xxx",
		"sonar.lf.logoUrl": "xxx",
		"sonar.lf.enableGravatar": "false",
		"sonar.developerAggregatedInfo.disabled": "xxx",
		"sonar.updatecenter.activate": "xxx"
	},
	"logoUrl": "xxx",
	"qualifiers": [
		"TRK",
		"APP",
		"VW"
	],
	"version": "9.9 (build 65466)",
	"productionDatabase": true,
	"instanceUsesDefaultAdminCredentials": false,
	"edition": "enterprise",
	"needIssueSync": false,
	"standalone": true
}
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.