13,723 questions
MS graph api batch response parsing
Ullas ML
1
Reputation point
const response = await graphClient.api('/$batch').post(content);
const batchResponse = new BatchResponseContent(response);
batchResponse.getResponses()
is empty where as batchResponse.getResponseById()
is not. any ideas whats happening here
We are invoking a batch request to fetch users like illustrated above. We do receive the response correctly but seeing issues parsing them. Please see attached sample response that we received
{
"responses": [
{
"id": "0",
"status": 200,
"headers": {
"Cache-Control": "no-cache",
"x-ms-resource-unit": "2",
"OData-Version": "4.0",
"Content-Type": "application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8"
},
"body": {
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
"value": [
{
"businessPhones": [
],
"displayName": "xxxxx",
"givenName": "xxxx",
"jobTitle": null,
"mail": "xxxxxxxxx",
"mobilePhone": null,
"officeLocation": null,
"preferredLanguage": "en-US",
"surname": "xxxx",
"userPrincipalName": "xxxxxxx",
"id": "xxxxxxx"
}
]
}
}
]
}
Microsoft Security | Microsoft Graph
Sign in to answer