Hello everyone,
I'm having an issue using the Graph API to add users to groups in my B2C tenant.
Give the volume to be processed, we have no other choice than to proceed with batch requests (https://learn.microsoft.com/en-us/graph/json-batching). Unfortunately, when we try to apply that by adding members to groups :
{
"requests": [
{
"id": "1",
"url": "https://graph.microsoft.com/v1.0/groups/{MyGroupID}/members/$ref",
"method": "POST",
"body": {
"@odata.id": "https://graph.microsoft.com/v1.0/directoryObjects/{MyUserID}"
},
"headers": {
"Content-Type": "application/json"
}
}
]
}
I get the following error :
{
"responses": [
{
"id": "1",
"status": 400,
"headers": {
"Content-Type": "application/json"
},
"body": {
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'https:'.",
"innerError": {
"date": "2023-06-21T22:33:16",
"request-id": "{MyRequestID}",
"client-request-id": "{MyClientRequestID}"
}
}
}
}
]
}
The effect is the same if I send multiples requests of the same type in the batch request. I get a 400 for each of them with the same error message.
I tried to use the exact same parameters in a "classic" single graph API call to see if something was wrong, but with the same IDs, on the same tenant, logged with the same account, I get a 204, and the group is added as expected :

So it's not about permissions nor context. Is the graph API simply not able to add new members to groups in a batch call ? That would be surprising...
If anyone has an idea that would be very helpful because it doesn't make any sense to me.
Thanks,
Antoine