Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Get JIRA baseurl by giving credentials through rest api Edited

Hi guys, I have been trying to get the base url of jira through rest api by passing credentials, but unable to do it. please help...

Thank you

2 answers

1 vote
Andy Heinzer Atlassian Team Jan 30, 2018

Try to make a REST call to the endpoint called /rest/api/2/serverInfo

It will contain the baseUrl as a parameter of that Jira instance.

to make rest call i need to give basurl

How to make a rest api call without giving domain ?? i need domain to make a call and that is what i want to get 

Dario B Atlassian Team Feb 27, 2018

@Mohammed Shaik Mehboob 

As already mentioned in the other replies, in order to call a REST API endpoint you must already know the base url.

Also, id.atlassian.com is mainly used for Single Sign On. This means that if you have multiple JIRA instances, after you log into id.atlassian.com, you can access all your JIRA instances without having to log-into all of them one by one.

Still,  after being authenticated into id.atlassian.com, you need to know which one your JIRA instances are in order to access them. :) 

I hope this helps clarifying.

 

Best Regards,
Dario
Atlassian Cloud Support  

@Dario B i really appreciate it, i was trying to do something different but that didnt end up well i couldnt explained it properly to you guys.

Thanks again

You are very welcome @Mohammed Shaik Mehboob. Please do not hesitate asking further questions or opening different threads if needed.

 

Have a nice day!

Dario

I know this is an old thread but I stumbled on it looking for the same answer as Mohammed and this thread is not answered.  Maybe phrased in a different way it can lead to an answer.

I am building a plugin that will hopefully have many users.  When making calls to the rest API should I always be using my-domain (hard coded into my plugin) or should I be using a domain that is relevant/applicable to my user/s?

If its the latter then there needs to be a way to lookup the domain of my user and dynamically use it as the base-url to make API calls.

***Edited***

I did a bit more searching and found this:

3.2 Construct the request URL

Requests that use OAuth 2.0 (3LO) are made via api.atlassian.com (not https://your-domain.atlassian.net). Construct your request URL using the following structure:

Since I am using OAuth 2 this means I need to change my request URL anyway. 

https://developer.atlassian.com/cloud/confluence/oauth-2-authorization-code-grants-3lo-for-apps/

Dario B Atlassian Team Jan 07, 2020

Hi @RodPienaar ,

Welcome to the Atlassian Community.

 I believe you have already found the answer by yourself, however, please confirm this is the case.

Also, for the future, please notice that this is not the best place to get help on development  related questions. The right resources are listed in https://developer.atlassian.com/resources. 

0 votes

Er, if you know where to go to ask a Jira for its base url, then you already have it.

I am implementing JIRA in my application and i want to verify credentials through rest api without asking for baseurl from user

I'm afraid your requirement is nonsense.

If you don't know the base url, then you can't go to it to ask it where it is.

Imagine a real-world example.  You know you want to get a telephone number for someone.  What you're asking is to be able to ring them up to get it.  But you don't have their number so you can't.

You need to re-think what you are doing here.  You MUST give it a base url somehow, if you want to connect to it.

Thanks for your concern. 

I believe you are good in imagination, imagine how you are logging into jira by giving just credentials, you dont see your domain/baseurl while logging. I want to implement the same.

Yes you do, it's in the browser's address bar.

That come after you log in 

No.  It does not.

To get to a login screen, I have to enter a baseurl into my browser.  Jira sees I am not logged in and asks, then it's username and password.

How do you get to a login screen if you don't enter the baseurl to get to it?

https://id.atlassian.com/login

I'm afraid you are using some alternate url.

Go to the url please, You need to enter only username.email and password you will be logged into your account no need of baseurl.

Andy Heinzer Atlassian Team Feb 01, 2018

Server and Cloud platforms work differently in this regard.  All the Jira Cloud instances are forcing users to go through he ID site as means to authentication, but Jira Server has no such requirement.  For Jira Server, the Jira site itself is handling authentication, unless you are using some other SSO solution like Crowd, Okta, etc.

Could you provide us more information about what you are trying to accomplish here?  Are you trying to create a plugin for Jira Cloud or for Jira Server?  

The rest endpoint I cited was actually for Jira Server.   If you were using Jira server it is possible that you could be connecting to that Jira instance on some other address that is not the baseurl (such as an IP, a simple hostname, or localhost if access directly).   In cases like that, then you can still make a rest call to that address in order to find out what the base url value has been set to in that instance.  

Hence when you mentioned base URL, I think both Nic and myself believed you were referring to Jira Server.  Since in Jira Cloud, you cannot set the base URL, it is hard coded based on the domain name you selected when first setting up that site.

Ok, just to clarify where I am coming from.  Yes, you go to id.atlassian.com/login and that logs you in to your Atlassian account.

Now, I have access to a number of Atlassian and Cloud systems.   Once logged in to my Atlassian account, I've got a token that will let me in to them.

Now, tell me how I get to Jira 1, Jira 2 or Jira 3?

Suggest an answer

Log in or Sign up to answer
TAGS

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you