[英]Unable to create new user using Azure Active Directory B2C Graph API with chinese character Json data
I am trying to create a user using AAD B2C graph API. 我正在尝试使用AAD B2C图形API创建用户。 It is working fine when the Payload Json is English Character, but If I create the Json Payload with a Chinese character, Its fails.
当有效载荷Json是英文字符时,它可以正常工作,但是如果我创建带有中文字符的Json有效载荷,则它将失败。
Json Payload: 杰森有效载荷:
{
"passwordProfile": {
"password": "Abc1234@#",
"forceChangePasswordNextLogin": false
},
"signInNames": [
{
"type": "emailAddress",
"value": "abc@gmail.com"
}
],
"accountEnabled": true,
"creationType": "LocalAccount",
"displayName": "林",
"mailNickname": "林",
"passwordPolicies": "DisablePasswordExpiration"
}
Error Details: 错误详情:
"Message": "One or more errors occurred. (Error Calling the Graph API: \\n{\\r\\n \\"odata.error\\": {\\r\\n \\"code\\": \\"Request_BadRequest\\",\\r\\n \\"message\\": {\\r\\n \\"lang\\": \\"en\\",\\r\\n \\"value\\": \\"Invalid value specified for property 'mailNickname' of resource 'User'.\\"\\r\\n },\\r\\n \\"requestId\\": \\"b2d0d3bf-394d-4ebd-a5b5-d905f1809c19\\",\\r\\n \\"date\\": \\"2019-02-15T06:55:06\\",\\r\\n \\"values\\": [\\r\\n {\\r\\n
“ Message”:“发生一个或多个错误。(调用图形API时出错:\\ n {\\ r \\ n \\” odata.error \\“:{\\ r \\ n \\” code \\“:\\” Request_BadRequest \\“, \\ r \\ n \\“消息\\”:{\\ r \\ n \\“ lang \\”:\\“ en \\”,\\ r \\ n \\“ value \\”:\\“为资源'的属性'mailNickname'指定的值无效用户'。\\“ \\ r \\ n},\\ r \\ n \\” requestId \\“:\\” b2d0d3bf-394d-4ebd-a5b5-d905f1809c19 \\“,\\ r \\ n \\” date \\“:\\” 2019-02 -15T06:55:06 \\“,\\ r \\ n \\”值\\“:[\\ r \\ n {\\ r \\ n
\\"item\\": \\"PropertyName\\",\\r\\n \\"value\\": \\"mailNickname\\"\\r\\n },\\r\\n {\\r\\n \\"item\\": \\"PropertyErrorCode\\",\\r\\n\\“ item \\”:\\“属性名称\\”,\\ r \\ n \\“值\\”:\\“ mailNickname \\” \\ r \\ n},\\ r \\ n {\\ r \\ n \\“ item \\”:\\“ PropertyErrorCode \\”,\\ r \\ n
\\"value\\": \\"InvalidValue\\"\\r\\n }\\r\\n ]\\r\\n }\\r\\n})"\\“ value \\”:\\“ InvalidValue \\” \\ r \\ n} \\ r \\ n] \\ r \\ n} \\ r \\ n})“
Please help me to solve the issue. 请帮我解决问题。
You need to specify the mailNickname as specified by the error: 您需要指定错误所指定的mailNickname:
{
"givenName": "会话",
"surname": "宋",
"mail": "abc@gmail.com",
"city": "TestCity",
"state": "hebei",
"country": "china",
"postalCode": "1245",
"mobilePhone": "12345678",
"mailNickname": "abc",
"accountEnabled": true,
"displayName": "displayname-here",
"passwordProfile": {
"password": "PasswordHere",
"forceChangePasswordNextLogin": true
},
"userPrincipalName": "abc@gmail.com"
}
I've also included the other properties the documentation mentions are required. 我还包括了文档中提到的其他属性。
You can see the reference here: https://docs.microsoft.com/en-us/previous-versions/azure/ad/graph/api/users-operations#create-a-user-work-or-school-account-- 您可以在此处查看参考: https : //docs.microsoft.com/zh-cn/previous-versions/azure/ad/graph/api/users-operations#create-a-user-work-or-school-account -
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.