You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.