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
Little late to the party, but as this is not answered still after 2 years, I'll try to help.
Once you have oauth access token of the user, you can make a get call on
https://api.atlassian.com/oauth/token/accessible-resources with token.
This will give a list of all the sites accessible to the user along with it's cloudIds and siteUrls.
More info here: https://developer.atlassian.com/cloud/jira/platform/oauth-2-3lo-apps/
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.
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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:
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:
https://api.atlassian.com/ex/jira/{cloudid}/{api}
https://api.atlassian.com/ex/confluence/{cloudid}/{api}
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/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Er, if you know where to go to ask a Jira for its base url, then you already have it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I am implementing JIRA in my application and i want to verify credentials through rest api without asking for baseurl from user
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes you do, it's in the browser's address bar.
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.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
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.