2017-09-27 70 views
0

我试图做一个POST请求Azure的AD GraphAPI建立在我的广告B2C租户用户,但我发现了以下错误错误调用图形API:Request_DataContractVersionMissing

"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

1.6版

本节列出了图形API 1.6版本的变化。

图形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":"[email protected]","otherMails":[],"preferredLanguage":"es-MX"} 

为什么我得到错误的任何线索?

+0

你能分享完整的JSON提交吗? (明显改变密码等) – spottedmahn

+0

@spottedmahn我加了有效载荷到问题 – pollirrata

+0

我试着提交你的json,我得到了'为资源'User''的属性'passwordPolicies'指定了无效的值.' – spottedmahn

回答

1

我看到一个问题:signInNamessignInName

sample graph create user call

Documentation for user entity

enter image description here

+0

感谢您的注意,我在我的代码中进行了更改,但它与目前的问题没有关系,虽然 – pollirrata

+0

,你让它成为一个数组? (不只是更改名称) – spottedmahn

+1

是的,更改了名称并将其作为数组发送 – pollirrata

1

有一些错误与API版本的查询参数:Request_DataContractVersionMissing

数据合同版本参数丢失。在所有请求中包含api-version作为查询参数。

不起作用 https://graph.windows.net/ebenefitsdev.onmicrosoft.com/users?api -version = 1.6

提交,当我得到Request_DataContractVersionMissing错误。

不工作 https://graph.windows.net/ebenefitsdev.onmicrosoft.com/users?api-version=1.6

不同的是连字符字符。一个是我在键盘上输入的'正常'的。另一个is from here

我怀疑这是一个复制粘贴问题(我过去经历过这些)。

+1

听起来可行,但是我没有复制粘贴值直到我试图检查编写代码时是否出错 – pollirrata

+0

Out of好奇心,你是否尝试通过键入并重试来替换连字符? –