使用Graph API请求physicalMemoryInBytes时收到404错误。

huangapple go评论60阅读模式
英文:

Getting 404 when requesting physicalMemoryInBytes using Graph API

问题

我目前从Graph Explorer收到的响应如下查询:https://graph.microsoft.com/beta/deviceManagement/managedDevices/11111111-1111-1111-1111-111111111111

{
"error": {
"code": "ResourceNotFound",
"message": "{ "_version": 3, "Message": "An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 0b8958f1-ec4b-20fb-40ed-e31e7d8044db - Url: https://fef.msua02.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices('5a9382a7-cfd4-4b93-b5f0-d8c8c69ed615')?api-version=2022-07-29", "CustomApiErrorPhrase": "", "RetryAfter": null, "ErrorSourceService": "", "HttpHeaders": "{}"}",
"innerError": {
"date": "2023-06-25T17:19:30",
"request-id": "b4a94f7b-6150-4b8d-8798-4d2ccb3449c2",
"client-request-id": "0b8958f1-ec4b-20fb-40ed-e31e7d8044db"
}
}
}

我迄今为止尝试过的方法:

  1. 在v1.0和beta之间切换:无论使用哪个端点版本,都会出现错误。
  2. 使用选择语句:根据Microsoft文档 - "以字节为单位的总内存。默认值为0。要检索实际值,需要进行GET调用,并将设备ID包含在选择参数中。支持:$select。只读。此属性是只读的。" 使用选择仍然导致相同的错误。
  3. 尝试在Azure上提交支持请求,建议操作是咨询Stack Overflow。

我原本期望返回表示所请求设备RAM的字节数。但实际上我收到了这个ResourceNotFoundError。

英文:

The response I currently receive from Graph Explorer with the following query: https://graph.microsoft.com/beta/deviceManagement/managedDevices/11111111-1111-1111-1111-111111111111

{
    "error": {
        "code": "ResourceNotFound",
        "message": "{  \"_version\": 3,  \"Message\": \"An error has occurred - Operation ID (for customer support): 00000000-0000-0000-0000-000000000000 - Activity ID: 0b8958f1-ec4b-20fb-40ed-e31e7d8044db - Url: https://fef.msua02.manage.microsoft.com/DeviceFE/StatelessDeviceFEService/deviceManagement/managedDevices('5a9382a7-cfd4-4b93-b5f0-d8c8c69ed615')?api-version=2022-07-29\",  \"CustomApiErrorPhrase\": \"\",  \"RetryAfter\": null,  \"ErrorSourceService\": \"\",  \"HttpHeaders\": \"{}\"}",
        "innerError": {
            "date": "2023-06-25T17:19:30",
            "request-id": "b4a94f7b-6150-4b8d-8798-4d2ccb3449c2",
            "client-request-id": "0b8958f1-ec4b-20fb-40ed-e31e7d8044db"
        }
    }
}

What I've tried so far:

  1. Switching between v1.0 and beta: The error is given regardless of the endpoint version used
  2. Using a select statement: According to Microsoft docs - "Total Memory in Bytes. Default is 0. To retrieve actual values GET call needs to be made, with device id and included in select parameter. Supports: $select. Read-only. This property is read-only." Using a select still results in the same error..
  3. Tried opening a support request on Azure, the recommended actions was to consult SO.

I was expecting a number in bytes to be returned representing the RAM of the requested device. Instead I get this ResourceNotFoundError

答案1

得分: 0

根据API的限制,目前仍然无法像这样在单个查询中检索所有设备的RAM:

https://graph.microsoft.com/beta/deviceManagement/managedDevices?$select=physicalMemoryInBytes,hardwareInformation

根据设计,上述查询会返回一个设备列表,其中的 "physicalMemoryInBytes" 为 0。

所以我提出的解决方案是在组织中的每个单独设备上运行以下查询,使用 Intune 设备 ID。为了将来的优化,发送多个批量请求可能有助于提高性能。

https://graph.microsoft.com/beta/deviceManagement/managedDevices/11111111-1111-1111-1111-111111111111?$select=physicalMemoryInBytes,hardwareInformation

英文:

I was querying using the Azure AD device ID and not the Intune device ID which both have the same format but are very much different things.

As per API limitations though, it is still not possible to retrieve the RAM of all devices in a single query like so:

https://graph.microsoft.com/beta/deviceManagement/managedDevices?$select=physicalMemoryInBytes,hardwareInformation

By design, the above results in a list of devices with "physicalMemoryInBytes": 0.

So the solution I have come up with is to run the following query on every individual device in the organization, using the Intune device ID. For future optimization, sending multiple batch requests might help improve performance.

https://graph.microsoft.com/beta/deviceManagement/managedDevices/11111111-1111-1111-1111-111111111111?$select=physicalMemoryInBytes,hardwareInformation

huangapple
  • 本文由 发表于 2023年6月26日 01:43:50
  • 转载请务必保留本文链接:https://go.coder-hub.com/76551704.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定