我指的是o365 API文档,用于添加日历事件的推送通知。我收到以下错误 - 交>>
array:4 [▼
"@odata.type" => "#Microsoft.OutlookServices.PushSubscription"
"Resource" => "https://outlook.office.com/api/v2.0/me/events"
"NotificationURL" => "https://mywebsite.com/notifications"
"ChangeType" => "Created,Updated"
]
Response>>
"{"error":{"code":"ErrorInvalidParameter","message":"Notification URL 'https://mywebsite.com/notifications?validationtoken=ODFkNDllYWEtMmExYi00NDVjLWJmNzUtOTBhZjg3MDAyNjhh' verification failed because the response body '\tsuccess\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000\u0000' is unexpected."}} ◀"
我的代码是 -
$post_data = [ "@odata.type"=> "#Microsoft.OutlookServices.PushSubscription",
"Resource"=> "https://outlook.office.com/api/v2.0/me/events",
"NotificationURL"=> 'https://mywebsite.com/notification',
"ChangeType"=> "Created,Updated",
// "expirationDateTime"=> "2018-05-09T18:23:45.9356913Z",
// "clientState"=> "testClientState"
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://outlook.office.com/api/v2.0/me/subscriptions",
//CURLOPT_URL => "https://graph.microsoft.com/beta/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($post_data),
CURLOPT_HTTPHEADER => array(
// Set Here Your Requesred Headers
'Authorization: Bearer '.TOKEN,
'Content-Type: application/json',
'X-CSRF-TOKEN: TOKEN-XXXXX'
),
));
如何解决错误?
提前致谢。