【发布时间】:2020-01-23 15:45:32
【问题描述】:
我正在尝试使用 Microsoft Graph API 的 Create Contacts 端点(文档在此处:https://docs.microsoft.com/en-us/graph/api/user-post-contacts?view=graph-rest-1.0&tabs=http)为我的用户注册新联系人。我按照 API 文档中的描述创建了正文,但出现以下错误:
{
"error": {
"code": "Request_BadRequest",
"message": "A value without a type name was found and no expected type is available. When the model is specified, each value in the payload must have a type which can be either specified in the payload, explicitly by the caller or implicitly inferred from the parent value.",
"innerError": {
"request-id": "daf78520-50e6-444b-97a2-779762b3e6ed",
"date": "2020-01-23T14:20:18"
}
}
}
使用的请求: 1. 发布https://graph.microsoft.com/v1.0/{{tenant_id}}/联系人; 2. 发布https://graph.microsoft.com/v1.0/me/contacts; 请求正文示例:
{
"givenName": "Yulia",
"surname": "Lukianenko",
"emailAddresses": [
{
"address": "yulia@lukianenko.onmicrosoft.com",
"name": "Yulia Lukianenko"
}
],
"businessPhones": [
"+1 732 555 0102"
]
}
有人遇到过这样的问题吗?你是怎么解决的?
提前感谢您的帮助!
【问题讨论】:
-
那个payload很好,我只是用它来POST到/me/contacts。但是,您的第一次 POST 尝试不起作用,该 URL 无效。您不能使用租户 ID。您是否尝试在Graph Explorer 中提出此请求?
-
杰森约翰斯顿,谢谢你的回复! Graph Explorer 中的行为是相同的。我怀疑这是我的许可证的问题。您使用什么类型的许可证?提前谢谢!
标签: azure-active-directory microsoft-graph-api microsoft-graph-contacts