Microsoft Graph API返回200 ok错误响应



我正在调用Microsoft graph API来获取特定用户所属的所有组名称。API被成功调用并返回200个响应代码,但是响应给出了内部服务器错误以及响应数据。

End point : https://graph.microsoft.com/v1.0/me/transitiveMemberOf/microsoft.graph.group?$count=true
Response : 
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#groups",
"value": [
}{
"error": {
"code": "InternalServerError",
"message": "A resource of type 'microsoft.graph.directoryRole' was found in a resource set that otherwise has entries of type 'microsoft.graph.group'. In OData, all entries in a resource set must have a common base type.",
"innerError": {
"date": "2021-09-06T07:18:07",
"request-id": "3102e263-e4d8-49db-b7db-5f99a975d19c",
"client-request-id": "3102e263-e4d8-49db-b7db-5f99a975d19c"
}
}
}
Value array made blank as it is having clients data. But response is having proper details but it is appended with above "InnerError".

解决方案张贴在这里工作:微软图形API不尊重OData

原因是Header Value缺失。

在这种情况下,最初的问题是不适当的错误当报头值丢失时反馈。

欢呼