We are delighted to share our new EIC Delivery Methodology for efficiently managing Saviynt Implementations and delivering quick time to value. CLICK HERE.

Multiple API call for creategroup json failing - Azure AD

Aashish-Handa
Regular Contributor
Regular Contributor

Hi Team,

We are trying to POST and PATCH a group entitlement in a single creategroup json using an OOTB Azure AD connector, but it fails. We have tried using the jsons separately in create and update group json on the same connection and it works fine. 

Would like to make multiple calls in the creategroup json itself while creating the group. Please find the json being used below:

{
"call": [
{
"name": "call1",
"connection": "userAuth",
"url": "https://graph.microsoft.com/v1.0/groups",
"httpMethod": "POST",
"httpParams": "{\"description\": \"${roles.description}\", \"displayName\": \"${roles.role_name}\", \"groupTypes\": [\"${(roles.customproperty21=='Office365')?'Unified':''}\"], \"mailEnabled\": \"${roles.customproperty22 == '1' ? true : false}\", \"mailNickname\": \"${roles.displayname}\", \"securityEnabled\": \"${roles.customproperty23 == '1' ? true : false}\",\"owners@odata.bind\": [\"${allOwner}\"]}",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/json"
},
"httpContentType": "application/json"
},
{
"name": "call2",
"connection": "userAuth",
"url": "https://graph.microsoft.com/v1.0/groups/${entitlementValue.entitlementID}",
"httpMethod": "PATCH",
"httpParams": "{\"description\": \"${roles.description}\", \"displayName\": \"${roles.role_name}\", \"groupTypes\": [\"${(roles.customproperty21=='Office365')?'Unified':''}\"], \"mailEnabled\": \"${roles.customproperty22 == '1' ? true : false}\", \"mailNickname\": \"${roles.customproperty2}\", \"securityEnabled\": \"${roles.customproperty23 == '1' ? true : false}\",\"owners@odata.bind\": [\"${allOwner}\"]}",
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/json"
},
"httpContentType": "application/json"
}
]
}

Request some assistance on the above.

Thanks

23 REPLIES 23

DixshantValecha
Saviynt Employee
Saviynt Employee

Hi @Aashish-Handa,

We are looking into your request and we will keep you posted.

DixshantValecha
Saviynt Employee
Saviynt Employee

Hi @Aashish-Handa,

I understand that you’re trying to make multiple API calls in a single creategroup JSON using an out-of-the-box (OOTB) Azure AD connector, but it’s failing. You’ve mentioned that using the JSONs separately in create and update group JSON on the same connection works fine.

From your description, it seems like you’re trying to POST and PATCH a group entitlement in a single operation. However, the POST and PATCH methods typically serve different purposes. The POST method is used to submit data to be processed to a specified resource, while PATCH is used to apply partial modifications to a resource.

In your case, you’re trying to create a group (POST) and then update that group (PATCH) in a single operation. This might be causing issues because the PATCH operation might be getting called before the POST operation has finished, resulting in the PATCH operation failing because the group doesn’t exist yet.

However, without more specific error messages or logs, it’s difficult to provide a more precise solution. I would recommend checking the  response when the POST and PATCH operations fail, as this might provide more insight into what’s going wrong.

Aashish-Handa
Regular Contributor
Regular Contributor

Hi @DixshantValecha ,

Thanks for responding.

I tried provisioning a group again with multiple API calls and can see the below error in logs:

"2023-12-12T09:49:14.185+00:00","{"log":"groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method com.fasterxml.jackson.databind.ObjectMapper#readValue.\n","stream":"stdout","time":"2023-12-12T09:49:13.90473791Z"}"
"ecm-worker","2023-12-12T09:49:14.185+00:00","{"log":"Cannot resolve which method to invoke for [null, class com.saviynt.provisoning.azure.AzureADProvisioningService$28] due to overlapping prototypes between:\n","stream":"stdout","time":"2023-12-12T09:49:13.904742531Z"}"

Attached are the complete logs. Task ID: 16572

Does this mean multiple API calls couldnt be made? Is there any other way I can achieve what is required.

Thanks

Aashish-Handa
Regular Contributor
Regular Contributor

Were you able to find anything from your end @DixshantValecha ?

{ "connection": "userAuth", "url": "https://graph1.microsoft.com/v1.0/groups", "httpMethod": "POST", "httpParams": "{\"description\": \"${roles.description}\", \"displayName\": \"${roles.displayname}\", \"groupTypes\": [\"${(roles.customproperty21=='Office365') ? 'Unified' : ''}\"], \"mailEnabled\": \"${roles.customproperty22 == '1' ? true : false}\", \"mailNickname\": \"${roles.displayname==null || roles.displayname==''? roles.role_name : roles.displayname}\", \"securityEnabled\": \"${roles.customproperty23 == '1' ? true : false}\",\"owners@odata.bind\": [\"${allOwner}\"]}", "httpHeaders": { "Authorization": "${accessToken}", "Content-Type": "application/json" }, "httpContentType": "application/json" }


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

How does this help me @rushikeshvartak ?

Thanks

Please try above json it will resolve your issue


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

But this seems to be a single POST call. What we require is a POST call followed by a PATCH call to update a certain attribute.

Please let me know if I am missing something.

Both of your call does same thing hence above json will resolve your issue


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Not exaclty. The call1 is used to POST a group with mailnickname mapped to the displayname, whereas call2 is used to PATCH the mailnickname with cp2 to the same group.

Please let me know if this clarifies it.

Thanks

Why 2 consecutive calls ?


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Hi @rushikeshvartak ,

This is because the mailnickname is being used to populate 2 attributes from our end since no extensionattribute is in place. 

So the first call populates an attribute which can be set one time and cannot be updated later, and then the second call does populate the other one.

Did you tried JSON i have shared ? based on that we can proceed on further changes


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Hi @rushikeshvartak ,

Yes, I started off with the same json when doing a single POST call. You can see the same as the call1 in the current json that I have.

POST call independently is working fine and creating the group. How do you wish me to proceed? Doing another consecutive POST call again wont work since the group is already created.

Thanks

You can try


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

Yep, did that already. It didnt allow me to POST stating the group already existed.

Thanks

PUT


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

PUT gives me an invalid httpmethod error.

Thanks,

DixshantValecha
Saviynt Employee
Saviynt Employee

The error message you’re seeing, groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method com.fasterxml.jackson.databind.ObjectMapper#readValue, is a common issue in Groovy when it’s not clear which method to invoke due to overlapping method signatures. This usually happens when you’re trying to call a method with a null argument, and there are multiple methods that could potentially match this call.

The second error message, Cannot resolve which method to invoke for [null, class com.saviynt.provisoning.azure.AzureADProvisioningService$28] due to overlapping prototypes between:, suggests that there might be an issue with how you’re calling a method in the AzureADProvisioningService class. It seems like the method call is ambiguous because of a null argument.

I will update you further on the same,Kindly share more findings from your end as well.

Thanks @DixshantValecha , Awaiting your response. Meanwhile I will let you know if I find something useful.

Aashish-Handa
Regular Contributor
Regular Contributor

Hi @DixshantValecha , @rushikeshvartak ,

Were you able to find anything?

I would like to mention that I was able to check some Microsoft document for graph API which can combine multiple requests in one http call. 

https://learn.microsoft.com/en-us/graph/json-batching#first-json-batch-request

We tried making this call via postman and were able to do that, however, when used it with Saviynt, it does not allow this as well.

{
"connection": "userAuth",
"url": "https://graph.microsoft.com/v1.0/$batch",
"httpMethod": "POST",
"httpParams": {
"requests": [
{
"id": "1",
"method": "POST",
"url": "/groups",
"body": {
"description": "Self help community for NewGroup",
"displayName": "NewGroup",
"groupTypes": [
"Unified"
],
"mailEnabled": true,
"mailNickname": "NewGroup",
"securityEnabled": true
},
"headers": {
"Content-Type": "application/json"
}
}
]
},
"httpHeaders": {
"Authorization": "${access_token}",
"Content-Type": "application/json"
},
"httpContentType": "application/json"
}

Can we check why this too isnt working when there is only a single payload here?

Thanks

what is error ?


Regards,
Rushikesh Vartak
If you find the response useful, kindly consider selecting Accept As Solution and clicking on the kudos button.

2023-12-19T20:37:13+05:30-ecm-worker-{"log":"2023-12-19 15:07:12,913 [quartzScheduler_Worker-3] DEBUG azure.AzureADProvisioningService - initializing AzureAD connection\n","stream":"stdout","time":"2023-12-19T15:07:12.914025246Z"}
2023-12-19T20:37:13+05:30-ecm-worker-{"log":"2023-12-19 15:07:12,990 [quartzScheduler_Worker-3] DEBUG azure.AzureADProvisioningService - Exception in processGroupTeamChannel : \n","stream":"stdout","time":"2023-12-19T15:07:13.002238283Z"}
2023-12-19T20:37:13+05:30-ecm-worker-{"log":"groovy.lang.MissingMethodException: No signature of method: com.fasterxml.jackson.databind.ObjectMapper.readValue() is applicable for argument types: (java.util.LinkedHashMap, com.saviynt.provisoning.azure.AzureADProvisioningService$28) values: [[requests:[[id:1, method:POST, url:/groups, ...]], ...], ...]\n","stream":"stdout","time":"2023-12-19T15:07:13.002268465Z"}
2023-12-19T20:37:13+05:30-ecm-worker-{"log":"Possible solutions: readValue(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.core.type.ResolvedType), readValue(com.fasterxml.jackson.core.JsonParser, com.fasterxml.jackson.core.type.TypeReference), readValue(com.fasterxml.jackson.core.JsonParser, java.lang.Class), readValue([B, com.fasterxml.jackson.core.type.TypeReference), readValue([B, com.fasterxml.jackson.databind.JavaType), readValue([B, java.lang.Class)\n","stream":"stdout","time":"2023-12-19T15:07:13.002273732Z"}
2023-12-19T20:37:13+05:30-ecm-worker-{"log":"\u0009at com.saviynt.provisoning.azure.AzureADProvisioningService.processGroupTeamChannel(AzureADProvisioningService.groovy:4216)\n","stream":"stdout","time":"2023-12-19T15:07:13.00227884Z"}
2023-12-19T20:37:13+05:30-ecm-worker-{"log":"\u0009at com.saviynt.provisoning.azure.AzureADProvisioningService.createUpdateDeleteGroupAzureAD(AzureADProvisioningService.groovy:4060)\n","stream":"stdout","time":"2023-12-19T15:07:13.002282891Z"}