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.
We are using MS Graph api to collect AD user information. One of our method suddenly stop working when using our groovy script in script runner.
Actually when calling the Graph API url from POSTMAN directly for requesting user information we receive the following response
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
"value": [
{
"businessPhones": [],
"displayName": "Rhea Sam",
"givenName": null,
"jobTitle": null,
"mail": "user@mydoamin.com",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": null,
"surname": null,
"userPrincipalName": "user@mydoamin.com#EXT#@rlxcom.onmicrosoft.com",
"id": "05906321-ed38-4bfd-9c9e-02bfb7d32405"
}
]
}
Until now our groovy script call for that same API was working well but then suddenly stop working .
Here is calling method code we are using
public String getGuestUserId(String AuthToken,String userEmail){
String _userId
def http = new HTTPBuilder("https://graph.microsoft.com/v1.0/users/?")
http.request(GET) {
requestContentType = ContentType.JSON
//uri.query = [ $filter:"mail eq '$userEmail'"].toString()
uri.query=[$filter:"mail eq '$userEmail'"]
headers.'Authorization' = "Bearer " + AuthToken
response.success = { resp, json ->
if (json.value){
_userId=json.value[0].id
}
else
_userId=-1 // user does not exist
}
// user ID not found : error 404
response.'404' = { resp ->
_userId = 'Not Found'
}
}
_userId
}
What is happening when executing this method now is that the json.value return an error saying : "No such property: value for class: java.lang.Object" and du to that jump to the else line and return _userId=-1
Note that if we try to return just the json.toString() then it return only
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
"value": []
What is wrong and why json.value sundenly stop working ?
Note :
we are using Jira DC 9.0 and Script runner 6.57.0
Thanks for your help regards
was due to caching in script runner
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.