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.
Dear all,
From script runner script we are using MS Graph APi to get information from particular user mentionned in an issue.
For that we call an API endpoint using HttpBuilder and from the response json we get the follwing output :
{
@odata.context=https://graph.microsoft.com/v1.0/$metadata#users,
value=[{ businessPhones=[],
displayName=Serge Cal GMAIL,
givenName=null,
jobTitle=null,
mail=user1.tom@gmail.com,
mobilePhone=null,
officeLocation=null,
preferredLanguage=null,
surname=null, userPrincipalName=user1.tom_gmail.com#EXT#@SCALDERARA.onmicrosoft.com, id=253bca1d-6c03-441f-92e4-e206c7d180f7
}]
}
The method sample I use is as below :
def http = new HTTPBuilder('https://graph.microsoft.com/v1.0/users?')
http.request(GET) {
requestContentType = ContentType.JSON
uri.query = [ $filter:"mail eq '$userEmail'".toString() ]
headers.'Authorization' = "Bearer " + AuthToken
response.success = { resp, json ->
_userId=json["value"]["id"] <<<= Do not work !!!!!
}
How can I access the value of value[0].Id member from the response delegate ?
Thanks for help
regards
I was able to find what seems to be the reference for that API
https://docs.microsoft.com/en-us/graph/api/resources/user?view=graph-rest-1.0#json-representation
So I think either of the following 2 notations will work:
_userId = json.id
_userId = json['id']
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.