chat_payload = {
"chatType": "oneOnOne",
"members": [
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["owner"],
"user@odata.bind": "https://graph.microsoft.com/v1.0/me"
},
{
"@odata.type": "#microsoft.graph.aadUserConversationMember",
"roles": ["owner"],
"user@odata.bind": f"https://graph.microsoft.com/v1.0/users/'{user_email}'"
}
]
}
response = requests.post('https://graph.microsoft.com/v1.0/chats', headers=headers, json=chat_payload )
if response.status_code == 201:
chat_id = response.json()['id']
# Send a message to the new chat
message_payload = {
"body": {
"content": "Hello, this is a test message!"
}
}
message_response = requests.post(f'https://graph.microsoft.com/v1.0/chats/{chat_id}/messages', headers=headers, json=message_payload)
print("LINE 55: ", message_response.status_code, message_response.json())
else:
print("LINE 57: " , response.status_code, response.json())
Поскольку user@odata.bind находится в формате JSON, почему возникает ошибка, указанная ниже?
400 {'error': {'code' : 'BadRequest', 'message': "В запросе отсутствует поле 'user@odata.bind'.", '