3

The documentation and examples on the JIRA REST api that I've seen so far don't cover the case where you want to identify the currently logged in user on a particular host (having no prior information about them).

I want to do this so I can just say 'get all issues assigned to me', rather than 'get all issues assigned to Bob' (as I would have to know the username 'Bob' for this).

Is this possible?

Many thanks

2 Answers 2

9

If you want to know the details of the current session (which also gives the user name) then the REST API URI path is /rest/auth/latest/session

Below is the JSON returned by the API

{

    "self": "<JIRA host>/rest/api/latest/user?username=bob",
    "name": "Bob",
    "loginInfo": {
        "failedLoginCount": 1,
        "loginCount": 2,
        "lastFailedLoginTime": "2011-11-17T19:27:50.097-0800",
        "previousLoginTime": "2011-11-20T19:06:58.412-0800"
    }

}
Sign up to request clarification or add additional context in comments.

1 Comment

This is working for me on Postman, but not when I implement the query on a script sending it via ajax, getting ERR_CONNECTION_RESET. Any idea why?
2

GET {jira_url}/rest/api/latest/myself

This will return the logged in user details, the same response as from

GET {jira_url}/rest/api/latest/user?username=<username>

but without specifying the username.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.