I am using confluence server 7.13.7. I want a REST API to get the currently logged-in user's username so I can use it in other API calls to fetch more details about the user further.
I know of a way by using the snippet:
var userFullname = $("#user-menu-link").attr("title");
to get the current user's username. But, in my use case; I am in need of a REST API.
What about: GET /rest/api/user/current ?
@Alex Koxaras _Relational_ thanks for the reply. Yes, I tried it and it is working perfectly fine. But, in my use case, I want to make an API call where I will not have direct access to the confluence interface and I will only have the required admin credentials. So, I was looking to make an API call where I can pass the admin token and other details and the user's mail (I will have access to the user's mail) and it will fetch down the username of that particular user.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That doesn't make sense, you said you wanted the current user's username. I don't see how you can achieve that when you are another person.
How can you make an API call when you can't "access confluence interface". It's web based application and so is REST, same http protocol.
What it sounds like now is that you are trying to simply "get username found by email address over REST", which Confluence doesn't have, you can search for users by usernames/userkeys, but not by email (https://docs.atlassian.com/ConfluenceServer/rest/7.12.3/#api/user). To do so you'd need to likely implement your own endpoint making use of either cache or indexed db table (I assume the column is not indexed by default), otherwise the performance would be horrible on large instances.
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.