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
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.