I have several Jira instances and some of them are at work. I need to know if they are Jira Cloud or Jira Server, using only curl or similar tool, without loggin in;)
The reason I'm asking is because I have problems logging in with my Personal Access Token (302 Redirect) and to ask a good question, I need to know what Jira I'm asking;)
you can use the serverInfo rest endpoint for that. That one also doesn't need authentication.
The curl command would look like that:
curl --request GET \
--url 'https://ecosystem.atlassian.net/rest/api/3/serverInfo' \
--header 'Accept: application/json'
This returns something like this:
{
"baseUrl": "https://ecosystem.atlassian.net",
"displayUrl": "https://ecosystem.atlassian.net",
"displayUrlServicedeskHelpCenter": "https://ecosystem.atlassian.net",
"version": "1001.0.0-SNAPSHOT",
"versionNumbers": [ 1001, 0, 0],
"deploymentType": "Cloud",
"buildNumber": 100242,
"buildDate": "2023-11-22T18:28:19.000-0600",
"scmInfo": "28471e573eec8495fd31d4570bca6ecd00da1242",
"serverTitle": "Ecosystem Jira",
"defaultLocale": { "locale": "en_US" },
"serverTimeZone": "Etc/UTC"
}
The attribute deploymentType has the value Cloud if it's a Jira Cloud. If it's missing or has another value, the instance is a Server/Data Center instance.
Cheers,
Matthias.
I'm not getting any output from curl when I issue that command.
Can the path be something different than
/rest/api/3/serverInfo
The JIRA instance is running here:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's just great, thanks;)
Just for contextual knowledge, is using a token against such Data Center instance the same as I've found for the cloud instance?
```
echo "" > ~/.netrc-for-atlassian
chmod 600 ~/.netrc-for-atlassian
echo "machine jira.eg.dk login <my.name@email.address> account <64-bit token" >> ~/.netrc-for-atlassian
curl -n ~/.netrc-for-atlassian https://jira.eg.dk/rest/api/2/issue/
```
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The usage for a Data Center instance is a bit different. You find more details about PATs for DC in this documentation. The main difference is that you need to pass the token as a bearer token. Here's a quote from the docs:
To use a personal access token for authentication, you have to pass it as a bearer token in the Authorization header of a REST API call.
Here's an example using cURL to call the REST API with a bearer token:
curl -H "Authorization: Bearer <yourToken>" https://{baseUrlOfYourInstance}/rest/api/content
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Jason Hunter
If you are trying to use curl for this, then you must already have the URL for the Jira instance, correct?
And by "Jira Cloud" you do mean the Software As A Service product hosted by Atlassian, where Atlassian manages all the Jira product updates, correct? You don't mean simply a Jira instance hosted on a system hosted by a cloud-provider like AWS, versus a Jira instance hosted on a physical server managed by a non-cloud-provider, correct?
All Jira Cloud instances are currently in the domain atlassian.net and the URLs are all "https://<somevalues>.atlassian.net". So, just parse the URL to determine if the instance is Jira Cloud or not.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Trudy Claspill, this is true for most of the Jira Cloud instances.
However, there are some exceptions to it. Really old Jira Cloud instances (e.g. k15t.jira.com) can have different urls. I'm not aware of all the variations though.
But more important, there's currently an EAP for custom domains for Jira running - and I expect some time next year, all customers can use them - so more and more different domains for Jira Cloud will pop up with the time.
@Jason Hunter, up to you which method you want to choose.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the correction @Matthias Gaiser _K15t_ !
I knew Atlassian was working on support for custom domains, but had not reviewed recent documentation. I did not realize they had changed the implementation plan to allow something other than atlassian.net. I think originally the an allowed customization of only the sub domain levels.
And I did not know there were older SaaS instances that had different domains.
Even though I'm a community leader, I'm still learning new things from this community. 🤗
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.