azure - 调用Graph API错误: Request_DataContractVersionMissing

标签 azure azure-ad-b2c azure-ad-graph-api

我尝试向 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支持。

enter image description here

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/

相关文章:

azure - 将 AuthenticationContext 和 ActiveDirectoryClient 与应用程序代理一起使用?

azure - 缓存用于在 Azure AD B2C 中签署 token 的公钥是否安全?

azure - 使用 Azure AD B2C 自定义身份提供程序 (OpenID Connect) 映射声明

azure - 从 Azure User Graph 获取唯一用户位置的方法

azure-ad-b2c - 如何使用图形 api 在 AAD B2C 中创建具有自定义属性的用户

ios - Azure AD B2C 刷新 token /ID token iOS Swift 4

azure - Application Insights 分析 让运算符(operator)

angular - 有没有办法在构建 Angular 应用程序时在 Azure CI 构建管道中提供environment.prod.ts 文件?

powershell - Cosmos DB REST API 范围查询授权

.net - Azure Batch 服务任务退出代码错误