Testing the Service Communications API No ratings yet.

0

Overview

This blog post demonstrates how to create an app registration in Azure Active Directory and to test access and query the Office 365 Service Communications API.

Creating an app registration

  1. In the Azure Portal click on Azure Active Directory in the navigation menu on the left then click on App registrations then click on New application registration on the right
  2. Fill in the Name and the Sign-on URL fields and click Create
  3. Click on Settings
  4. On the Settings page click on Required permissions
  5. On the Required permissions page click Add
  6. On the Add API access page click Select an API
  7. On the Select an API page select Office 365 Management APIs and click Select
  8. On the Enable Access page, click the checkboxes for the appropriate access then click Select
  9. Back on the Add API access page, click Done
  10. On the Required permissions page click Grant permissions
  11. If you wish to make use of Application* tokens instead of Delegate** tokens, on the Settings page click on Keys
  12. To generate a new Key (client secret) type in a Description, select the validity period in the Expires column and click Save
  13. Make a copy of the key value as you won’t be able to retrieve it if you navigate away from this page
  14. Go back to the App registrations page and click on Endpoints to retrieve the authorization and token endpoints
  15. Make note of the OAUTH 2.0 TOKEN ENDPOINT and OAUTH 2.0 AUTHORIZATION ENDPOINT values

* Application Permissions: Your client application needs to access the web API directly as itself (no user context). This type of permission requires administrator consent and is also not available for native client applications.

** Delegated Permissions: Your client application needs to access the web API as the signed-in user, but with access limited by the selected permission. This type of permission can be granted by a user unless the permission requires administrator consent.

Testing the Office 365 Service Communications API

Bassam wrote a script that allows testing the functionality of the Office 365 Service Communications API without the need for any special tools.

The script Test-ServiceCommunicationsAPI.ps1 is available to download from our Downloads page. To run it you will need the following information:

  • The Application ID for the app you’ve registered previously
  • An app key that you would’ve created previously while registering your application
  • The domain name or tenant ID of your tenant

The script supports the following operations:

  • GetServices
  • GetCurrentStatus
  • GetHistoricalStatuses
  • GetMessages

Running the script

Syntax

To run the script you will need to use the following syntax:

Test-ServiceCommunicationsAPI.ps1 -AppID APPLICATION_ID -AppSecret KEY -DirectoryID TENANT_NAME_OR_ID -Operation OPERATION -LogFile LOG_FILE_PATH

where:

  • APPLICATION_ID is the ID of the application you’ve registered previously
  • KEY is the app key you’ve generated previously during the app registration
  • TENANT_NAME_OR_ID is the DNS name or ID of your tenant
  • OPERATION is the name of the operation you wish to perform. This can only have one of the values indicated above
  • LOG_FILE_PATH is an optional parameter indicating the path to the file you wish to capture the transcript in. A log file named TestServiceCommunicationAPI_Log.txt is created by default in current directory

Example

Test-ServiceCommunicationsAPI.ps1 -AppID 45d471a3-c516-49ae-b600-7a44cdc426dc -AppSecret MmsrCxFMlbRZ4zWq4s1KCk5Uu1pFBHsNT8+HkBe9cG8= -DirectoryID contoso.onmicrosoft.com -Operation GetServices

Output example

{
   "@odata.context":"https://office365servicecomms-prod.cloudapp.net/api/v1.0/contoso.onmicrosoft.com/$metadata#Services","value":[
     {
       "Id":"Bookings","DisplayName":"Microsoft Bookings","Features":[
         {
           "DisplayName":"Microsoft Bookings","Name":"MicrosoftBookings"
         }
       ]
     },{
       "Id":"Exchange","DisplayName":"Exchange Online","Features":[
         {
           "DisplayName":"Sign-in","Name":"Signin"
         },{
           "DisplayName":"E-Mail and calendar access","Name":"Access"
         },{
           "DisplayName":"E-Mail timely delivery","Name":"Delivery"
         },{
           "DisplayName":"Management and Provisioning","Name":"Provisioning"
         },{
           "DisplayName":"Voice mail","Name":"UnifiedMessaging"
         }
       ]
     },{
       "Id":"kaizalamessagingservices","DisplayName":"Microsoft Kaizala","Features":[
         {
           "DisplayName":"Kaizala Messaging","Name":"kaizalamessaging"
         },{
           "DisplayName":"Kaizala Management Portal","Name":"kaizalaportal"
         }
       ]
     },{
       "Id":"Lync","DisplayName":"Skype for Business","Features":[
         {
           "DisplayName":"Audio and Video","Name":"AudioVideo"
         },{
           "DisplayName":"Federation","Name":"Federation"
         },{
           "DisplayName":"Management and Provisioning","Name":"ManagementandProvisioning"
         },{
           "DisplayName":"Sign-In","Name":"Sign-In"
         },{
           "DisplayName":"All Features","Name":"All"
         },{
           "DisplayName":"Dial-In Conferencing","Name":"DialInConferencing"
         },{
           "DisplayName":"Online Meetings","Name":"OnlineMeetings"
         },{
           "DisplayName":"Instant Messaging","Name":"InstantMessaging"
         },{
           "DisplayName":"Presence","Name":"Presence"
         },{
           "DisplayName":"Mobility","Name":"Mobility"
         },{
           "DisplayName":"Cloud PBX","Name":"CloudPBX"
         },{
           "DisplayName":"PSTN Calling","Name":"PSTNCalling"
         },{
           "DisplayName":"Meeting Broadcast","Name":"MeetingBroadcast"
         }
       ]
     }
   ]
 }

Revisions

Type Date Author / Editor Notes
Original 15th Aug 2019 Andrei Ghita  
0

Please rate this

Leave a Reply

Your email address will not be published. Required fields are marked *