Hi,
I am trying to get accountID using email.
When I use a simple REST API call with API tester - it's working fine.
But when I use scriptrunner - something goes wrong. Please help, I am new in groovy and sometimes it's hard to understand. Here is my code:
def userEmail = "oleksandr.melnyk@example.com"
def response = get('/rest/api/3/user/search?query=' + userEmail)
.header('Content-Type', 'application/json')
.asObject(Map)
logger.info('Id=' + response.body.accountId)
return response
String email = "test@test.com"
def url = "https://xxxxxx.atlassian.net/rest/api/3/user/picker?query=${email}"
def response = get(url).header('Authorization', 'Basic xxxxxxx').asObject(Map)
return response.body.users.accountId[0]
Thank you! @Tansu Akdeniz
String email = "test@rest.com"
def url = "/rest/api/3/user/picker?query=${email}"
def response = get(url).header('Content-Type', 'application/json').asObject(Map)
return response.body.users.accountId[0]
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Tansu Akdeniz,
How would get the AccountID from a Jira Cloud single user picker custom field linked to an issue using scriptrunner or is this one for Adaptavist's Kristian Walker?
Rgds
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Tansu Akdeniz Is there any way to get the AccountID by searching with the username instead of the email?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.