我尝试向 Azure AD GraphAPI 发出 POST 请求,以在我的 AD B2C 租户中创建用户,但收到以下错误
"Error Calling the Graph API:
{
"odata.error": {"code": "Request_DataContractVersionMissing",
"message": {"lang": "en",
"value": "The specified api-version is invalid. The value must exactly match a supported version"}
}
我确实发送了版本,并且基于docs支持。
Version 1.6
This section lists the changes for Graph API version 1.6.
Graph API version 1.6 introduces the following feature changes:
Added support for Azure Active Directory B2C local account users. This involves new properties on the User entity and a new complex type SignInName to support local account sign-in to Azure Active Directory B2C tenants. For more information about Azure Active Directory B2C, see the Azure Active Directory B2C documentation.
[编辑] 提交的json
{"accountEnabled":true,"signInNames":[{"type":"userName","value":"ausername"}],"creationType":"LocalAccount","displayName":"A display name","passwordProfile":{"password":"a password","forceChangePasswordNextLogin":true},"passwordPolicies":"policies","country":"MX","givenName":"Fstname","surename":"Lstname","department":"Dpt","jobTitle":"Title","mail":"<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="afc2cec6c3efdccaddd9cadd81ccc0c2" rel="noreferrer noopener nofollow">[email protected]</a>","otherMails":[],"preferredLanguage":"es-MX"}
关于我为什么会收到错误的任何线索吗?
最佳答案
api-version 查询参数有问题:Request_DataContractVersionMissing
Data contract version parameter is missing. Include api-version as a query parameter with all your requests.
不起作用 https://graph.windows.net/ebenefitsdev.onmicrosoft.com/users?api ‐版本=1.6
提交时出现 Request_DataContractVersionMissing
错误。
有效 https://graph.windows.net/ebenefitsdev.onmicrosoft.com/users?api-version=1.6
区别在于连字符。一种是我在键盘上输入的“正常”的。其他is from here .
我怀疑这是复制粘贴问题(我过去遇到过这些问题)。
关于azure - 调用Graph API错误: Request_DataContractVersionMissing,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46455291/