gpt4 book ai didi

microsoft-graph-api - Microsoft Graph API @odata.type 是否包含 "#"字符?

转载 作者:行者123 更新时间:2023-12-03 08:40:37 24 4
gpt4 key购买 nike

Microsoft Graph API 基于 OData,每个对象都有一个 @odata.type

查看user resource type@odata.type#microsoft.graph.user"

{
"@odata.type": "#microsoft.graph.user",
"id": "String (identifier)",
"deviceEnrollmentLimit": 5
}

但是 group resource type 中的示例@odata.typemicrosoft.graph.user 并且不以 #

开头
{
...
"members": [ { "@odata.type": "microsoft.graph.directoryObject" } ],
"membersWithLicenseErrors": [{"@odata.type": "microsoft.graph.user"}],
...
}

Types OData 版本 4.0 通用架构定义语言 (CSDL) 的“部分”似乎没有指出与此主题相关的任何标准。

问题:# 字符是 Microsoft 定义的 @odata.type 的一部分还是 OData 规范的一部分,或者只是某些 OData 的约定提供商使用什么?

最佳答案

我希望这个问题有一个简单的答案。描述 OData JSON 格式的 OData 规范有以下说法:

For payloads described by an OData-Version header with a value of 4.0, this name MUST be prefixed with the hash symbol (#); for non-OData 4.0 payloads, built-in primitive type values SHOULD be represented without the hash symbol, but consumers of 4.01 or greater payloads MUST support values with or without the hash symbol.

http://docs.oasis-open.org/odata/odata-json-format/v4.01/cs01/odata-json-format-v4.01-cs01.html#_Toc499720587

Microsoft Graph Beta 版支持 4.01,但 V1.0 API 大部分使用 4.0。最好的选择是始终包含非基本类型的哈希符号。

关于microsoft-graph-api - Microsoft Graph API @odata.type 是否包含 "#"字符?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62898269/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com