通过 AD 图表更新 B2C 自定义属性字符串集合 API
Update B2C Custom Attribute String Collection via AD Graph API
我可以定义数据类型为 stringCollection
的 custom attribute 并通过 Azure AD Graph API 更新它吗?我的实验失败了:
The request body contains unexpected characters/content for the specified content type and encoding
自定义属性定义
<ClaimType Id="extension_array_test">
<DisplayName>Array Test</DisplayName>
<DataType>stringCollection</DataType>
<UserHelpText>Array Test in Token</UserHelpText>
</ClaimType>
{
"extension_[my-guid]_array_test": ["value 1", "value 2"]
}
Error Calling the Graph API:
{
"odata.error": {
"code": "Request_BadRequest",
"message": {
"lang": "en",
"value": "The request body contains unexpected characters/content for the specified content type and encoding."
}
}
}
您提供的文档中的第二条注释指出扩展属性目前仅支持字符串数据类型。
作为替代方案,您可以将数据存储为转义 JSON,如下所示:
"extension_{GUID}_JsonAttribute": "{\"Item1\":\"Test\",\"Item2\":\"Data\"}"
我可以定义数据类型为 stringCollection
的 custom attribute 并通过 Azure AD Graph API 更新它吗?我的实验失败了:
The request body contains unexpected characters/content for the specified content type and encoding
自定义属性定义
<ClaimType Id="extension_array_test">
<DisplayName>Array Test</DisplayName>
<DataType>stringCollection</DataType>
<UserHelpText>Array Test in Token</UserHelpText>
</ClaimType>
{
"extension_[my-guid]_array_test": ["value 1", "value 2"]
}
Error Calling the Graph API:
{
"odata.error": {
"code": "Request_BadRequest",
"message": {
"lang": "en",
"value": "The request body contains unexpected characters/content for the specified content type and encoding."
}
}
}
您提供的文档中的第二条注释指出扩展属性目前仅支持字符串数据类型。
作为替代方案,您可以将数据存储为转义 JSON,如下所示:
"extension_{GUID}_JsonAttribute": "{\"Item1\":\"Test\",\"Item2\":\"Data\"}"