我正在尝试使用Microsoft Graph API的创建联系人终结点(文档在此处:https://docs.microsoft.com/en-us/graph/api/user-post-contacts?view=graph-rest-1.0&tabs=http)为我的用户注册新联系人。我按照API文档中的描述创建了body,但得到了以下错误:
{
"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. POST https://graph.microsoft.com/v1.0/{{tenant_id}}/contacts;2. POST https://graph.microsoft.com/v1.0/me/contacts;Request body示例:
{
"givenName": "Yulia",
"surname": "Lukianenko",
"emailAddresses": [
{
"address": "yulia@lukianenko.onmicrosoft.com",
"name": "Yulia Lukianenko"
}
],
"businessPhones": [
"+1 732 555 0102"
]
}
有人遇到过这样的问题吗?你是怎么解决这个问题的?
提前感谢您的帮助!
发布于 2020-01-24 05:13:18
这里的POST请求不正确。应该是:https://graph.microsoft.com/v1.0/me/contacts
此外,您还需要确保在AAD中注册的应用程序被授予"Contacts.ReadWrite“权限。
附言:我在使用graphExplorer的示例中使用了相同的JSON,并且成功地创建了联系人。
https://stackoverflow.com/questions/59882314
复制相似问题