Forum Discussion
How to use Office 365 Service Communications API V2 with PowerShell
Just today, when I ran this code to connect to the Office 365 Service API.
It looks like the API Service EndPoint is down, and I'm not sure if this is tempory or permanent.
Got me thinking about moving to to the v2 API (https://docs.microsoft.com/en-us/office/office-365-management-api/office-365-service-communications-api-reference). I was able to go through registering the app in Azure, but the way it is handled in PowerShell looks way different than that of the v1 API.
Has anyone had any success in scripting with the v2 API for retrieving the Office 365 Service Status?
- Shawn BeckersBrass Contributor
We are using the O365ServiceCommunications module written by Matt McNabb (https://github.com/mattmcnabb/O365ServiceCommunications) and started receiving "The service is unavailable" messages on 9/15. We didn't realize the API that this module utilizes was slated to be deprecated. We would also be interested if anyone has any code to share on how to retrieve health and message center events using v2 of the API.
- June CastilloteCopper Contributorfigured it out, after hours of testing. really lacking documentation.
I find that the v2 API filter doesn't work, as it returns all messages to your rest query. Although this is no big deal since the results can be filtered for consumption anyway.
I'm still working on the script, and would probably be sharing tomorrow.- Shawn BeckersBrass Contributor
FYI - It seems like the older API endpoint is back up again. At least for us it's working. However, we do plan to work on converting our scripts to using the newer API. Biggest hurdle for us was just registering the app in Azure and figuring out the best way to manage the authentication tokens. The documentation is definitely lacking, but the objects returned from the API seem somewhat similar to those of the older API.
- June CastilloteCopper Contributor
Hi All,
I'm sorry it took long for me to update this.
I have published a working, functional script that I am already using in production.
You can read through the post here:
https://www.lazyexchangeadmin.com/2018/10/shd365.html
I hope this helps.