0
votes

So Im using the Notification REST API from office 365 to get changes of a calendar. My subscription request looks like so (its an array in PHP which i transform into json later on):

        "@odata.type" => "#Microsoft.OutlookServices.PushSubscription",
        "Resource" => "me/calendars/<calendar-id>/events",
        "NotificationURL" => "https://mywebhook.azurewebsites.net/api/send/reservation",
        "ChangeType" => "Created, Deleted",
        "ClientState" => "c75831bd-fad3-4191-9a66-280a48528679"

I pass it on to the office API with my access token and email and it works fine. And I can see the results on the website ("https://mywebhook.azurewebsites.net/view/reservation") when changes happen in the calendar.

Where's the problem? How can my web app see the data that's been posted to the last website? Because I want my web app to refresh/update/react when there's a change in a calendar of office 365. Is this even possible?

My web app runs on a localhost wampserver. I tried to put a localhost url as notificationURL but that gave a Bad Request Error. My web app is also programmed using PHP.

If something's unclear do tell. My english ain't top notch. Thanks in advance for your time.

1

1 Answers

0
votes

localhost url can't be used as notificationURL, notificationURL should be directly accessible via the internet, because other server will POST the data to it. You could make your localhost wampserver poll the notification server and sync data . You could use ajax polling ,please click here for demo .Also you could use Websocket,you can see good example of Websockets at work here. Keep in mind this should work with most modern post IE9+ and other browsers.