通过AD Graph API更新B2C自定义属性字符串集合 [英] Update B2C Custom Attribute String Collection via AD Graph API

查看:93
本文介绍了通过AD Graph API更新B2C自定义属性字符串集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以定义

Can I define a custom attribute whose data type is stringCollection and update it via the Azure AD Graph API? My experiment is failing:

请求正文包含用于指定内容类型和编码的意外字符/内容

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>  


使用


Using the Graph API Sample client

{
    "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."
    }
  }
}

推荐答案

您提供的文档中的第二个注释指出扩展属性当前仅支持字符串数据类型.

The second note in the documentation you provided states extension attributes currently only support the string data type.

作为替代方案,您可以像这样将数据存储为转义的JSON:

As an alternative you could store your data as escaped JSON like this:

"extension_{GUID}_JsonAttribute": "{\"Item1\":\"Test\",\"Item2\":\"Data\"}"

这篇关于通过AD Graph API更新B2C自定义属性字符串集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆