ReadiNow API Callouts can connect to Microsoft Azure APIs by using OAuth 2.0 authentication. This page describes how to set up an API Callout Endpoint to call the Microsoft Graph Service; and a workflow retrieve a list of uses.
Configure authentication
Azure offers two permission models:
- Application - where a software application such as ReadiNow connects to an API service on its own behalf
- Delegated - where a software application is connecting to an API service on behalf of a specific end user
Generally the application model is recommended and most suitable for use by ReadiNow API Callouts. However, certain APIs may only be made accessible via the delegated model.
Before proceeding, set up authentication and permissions by following the steps at either:
- Configuring Azure with Application Permissions (recommended)
- Configuring Azure with Delegated Permissions
Additional information can also be found in the Microsoft Azure reference at: Configuring a client application to access web APIs
Add an endpoint in ReadiNow that can query for all objects
The following example shows how to create an API Callout that will call the Active Directory users API to return a list of users.
- Click on the APIs tab and click New
- Name: Get AD Users (or some other suitable name)
- Set the Method to GET
- Set the Query string to https://graph.microsoft.com/v1.0/users
- On the Response Template tab, enter: (note: the data values do not matter. The template just requires an example of the expected reply format.)
{ "value": [ { "id": "b6168b8e-d059-4a60-b4e3-f17f7eb746d8", "businessPhones": [], "displayName": "Sample", "givenName": "Sample", "jobTitle": "Sample", "mail": "sample@sample.com", "mobilePhone": "123123123", "officeLocation": null, "preferredLanguage": null, "surname": null, "userPrincipalName": "sample@sample.com" } ] }
- Save the API
Create a workflow to use the API
The following provides an example of how to create a workflow that will call the above API Callout, and display the results to a log message.
- Go to Workflows and create a new workflow
- Drop on the API Callout activity
- Select the "Get AD Users" API, or whichever name was given to it previously
- Drop a log activity after it
- Set the message to: [API Callout.HTTP Response Body]
- Drop a For Each activity after it
- Set the List parameter to: [API Callout.Response].[Value]
- Connect the Finished exit to the end
- Drop a log activity after the for loop exit
- Set its message parameter to be, for example: [For Each.Record].displayName + ' ' + [For Each.Record].mail
- The data can similarly be accessed from the For Each record to create new records.
- Save and run the workflow
- Run with Show Trace turned on so that the log messages will be displayed