REST API to get currently logged in user's username

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.

This seems to be the same question as this one. You seem to be posting the same question, multiple times across multiple forums.

@sunnyape yes you’re right. The one you’re mentioning is a general community. I have posted this question across multiple forums but not multiple times to get more reach as it is a bit urgent for me to get the solution. This forum is a developer’s forum and the other one is a general one.

What was wrong with the ‘solution’ that was provided in the Community forum, that Confluence Server does not have a REST API endpoint that will provide you with another user’s username based on their email address?

If you read the Confluence Server v7.13.1 REST API documentation, you can see it for yourself… no such functionality exists for the api/user endpoint.

yeah, there’s nothing wrong with the provided solution. Actually, I had posted the question on several forums including SO at the same time. It is just a matter of fact that I got the response on the community one and not the SO or developer ones because some people prefer to use only a particular forum. So, I was hoping for a reply from either of these and I eventually got one from the community itself.