azure 调用图形API时出错:请求_数据合同版本缺失

b5buobof  于 2023-03-09  发布在  其他
关注(0)|答案(3)|浏览(109)

我尝试向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"}
}

我确实发送了版本,并且基于文档支持该版本。

版本1.6
本节列出了Graph API版本1.6的更改。
Graph API版本1.6引入了以下功能更改:
添加了对Azure Active Directory B2C本地帐户用户的支持。这涉及用户实体上的新属性和新的复杂类型SignInName,以支持本地帐户登录到Azure Active Directory B2C租户。有关Azure Active Directory B2C的详细信息,请参阅Azure Active Directory B2C文档。
[编辑]提交的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":"mail@server.com","otherMails":[],"preferredLanguage":"es-MX"}

你知道为什么我会得到这个错误吗?

jbose2ul

jbose2ul1#

api-version查询参数有问题:Request_DataContractVersionMissing
缺少数据协定版本参数。请将api-version作为查询参数包含在所有请求中。

不工作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
我怀疑这是一个复制粘贴问题(我在过去经历过这些)。

nhaq1z21

nhaq1z212#

我看到一个问题:signInNames不是signInName

用户实体文档

cunj1qz1

cunj1qz13#

对于未来的读者,我在www.example.com的2.0版本中遇到了这个问题graph.windows.net,但不是连字符的问题。如果用于获取graph.windows.net资源令牌的客户端ID不正确,似乎也会显示此错误。

相关问题