Wednesday, 27 February 2019

Office365 SharePoint : Converting Enterprise System Data using Azure Integration Account Map Component and Logic Apps

Views
This article explains the advantages of using Azure Integration account along with Azure Logics App for integrating enterprise systems with Office 365 SharePoint.  


Azure Integration Account & Logic Apps:


Azure Integration account provides ways to store and manage the components/artifacts, that includes agreements, maps, schemas, etc. In this article, let us look at leveraging maps component and also look at advantages of using it.  

Maps component is used for mapping the data from one system into another system. The mapping of two systems, those using different form of data. These scenarios are handled by using liquid template mapping or XSLT mapping formats. Here in this article, liquid templates are used for mapping the data. 

Azure Logic apps is leveraged to explain the enterprise integrations scenarios, along with usage of Azure Integration account’s map. In the scenarios explained below, I have shown the data flow between HTTP service and SharePoint for easy understanding. 



Business Scenario & Mapping:


We are considering two services. One HTTP services that uses JSON for representing the data, and other SharePoint REST API that again uses JSON to represent the data. But there is variation in format that is being used between these two services. Say for example, we are using services to move the book details from one HTTP post request to SharePoint. The following picture depicts the data transformation. 
Data Representations between two services/systems
Data Representations between two services/systems considered
Note: Assume HTTP service as another system, which posts data. For our easy/better understanding, i have simplified the logic with simple data representations.

In our Map component, we will leverage liquid template mapping for transforming one format of JSON to another. The liquid mapping format file is shown below. Save the file content as splistitem.liquid, which will be uploaded to the map component, in the next section. Basically, the content denotes the post data used for creating items on SharePoint list using REST API. 
Liquid Template used for converting data into JSON form compatible for SharePoint system
Liquid Template used for converting data into JSON form compatible for SharePoint system


Configuring Azure Integration Account & Mapping Component:


Let us look at the steps involved in creating the integration. 
  • Navigate to Azure Portal, and create a integration account service as shown below. 
Creating Integration Account
Creating Integration Account

  • Once created, navigate to the service and select the Maps component under components section. 
  • Click Add Map, and provide the  
    • Name,
    • Map type
    • And Map File. Upload the splistitem.liquid saved in the previous section. 
Map File - Contains the liquid template for transforming data
Map File - Contains the liquid template for transforming data


Configuring Azure Logic Apps:


This section tells, how the data flow configuration has been done.  

As a first step, go to the logic apps service, and map the integration account created in the previous section. 
Mapping Integration Account to Azure Logic Apps
Mapping Integration Account to Azure Logic Apps

As per our requirement, the data flows from HTTP service endpoint into SharePoint. So the following denotes the flow.  
  • HTTP request is used as a trigger to initiate the data post request, (This could replaced with any other system request endpoint, like Azure Functions, etc. For our better understanding, we have chosen the HTTP request service).  
    • Create “When a HTTP request is received” as a trigger. 
    • The schema file of source JSON format is generated by pasting the source JSON payload. I.e., HTTP service JSON format is used to generate the schema file. 
    • Post method is chosen for posting data. 
    • Once saved, the HTTP URL will be generated, which could be used from postman tools for triggering flows. 
Step 1 : Trigger Action - Data to be posted from one system
Step 1: Trigger Action - Data to be posted from one system
  • Mapping actions are configured to convert the JSON from existing (HTTP service) format into new (SharePoint) format. 
Transforming Data From one system to another
Step 2: Transforming Data From one system to another

  • Send HTTP request to SharePoint action is used to create the data on SharePoint list. (This could have been done by simply choosing create item action. But for our requirement scenario, we have chosen the REST endpoint request action) 
Step 3. Sending HTTP request with post content using REST API
Step 3. Sending HTTP request with post content using REST API


Publish/Test:


  • Save the flow, and run the trigger. 
  • From postman tool, send an request to the HTTP request URL by posting the data. 
Postman tool to trigger the HTTP endpoint with post data - Test
Postman tool to trigger the HTTP endpoint with post data - Test

  • The data will now be available on SharePoint list as shown below. 
Data from HTTP endpoint to SharePoint
Data from HTTP endpoint to SharePoint