/** This example script console script shows how to get a user based on a specified username.* "All right, title and interest in this code snippet shall remain the exclusive intellectual property of Adaptavist Group Ltd and its affiliates. Customers with a valid ScriptRunner* license shall be granted a non-exclusive, non-transferable, freely revocable right to use this code snippet only within their own instance of Atlassian products. This licensing notice cannot be removed or* amended and must be included in any circumstances where the code snippet is shared by You or a third party."*/// The username to search fordefuserName='<UsernameHere>'// return the user specifieddefresult=get('/rest/api/2/user/').header('Content-Type','application/json').queryString("username",userName).asObject(Map)// If the user is found return the details for the userif(result.status==200){returnresult.body}else{return"Failed to find user with the name of ${userName} : Status: ${result.status} ${result.body}"}
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.