Connecting to Azure APIs

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:

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.

  1. Click on the APIs tab and click New
  2. Name: Get AD Users (or some other suitable name)
  3. Set the Method to GET
  4. Set the Query string to https://graph.microsoft.com/v1.0/users
  5. On the Response Template tab, enter:      (note: the data values do not matter. The template just requires an example of the expected reply format.)
  6. {
        "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"
            }
        ]
    }
  7. 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.

  1. Go to Workflows and create a new workflow
  2. Drop on the API Callout activity
  3. Select the "Get AD Users" API, or whichever name was given to it previously
  4. Drop a log activity after it
    1. Set the message to: [API Callout.HTTP Response Body]
  5. Drop a For Each activity after it
    1. Set the List parameter to: [API Callout.Response].[Value]
    2. Connect the Finished exit to the end
  6. Drop a log activity after the for loop exit
    1. Set its message parameter to be,  for example:  [For Each.Record].displayName + ' ' + [For Each.Record].mail
    2. The data can similarly be accessed from the For Each record to create new records.
  7. Save and run the workflow
    1. Run with Show Trace turned on so that the log messages will be displayed