Configure And Use REST APIs In BizTalk Server 2020

Introduction

 
In January 2020, Microsoft released the latest version of BizTalk (BizTalk Server 2020) with multiple new features, which helps to build world-class integration applications.
 
These new features are running on the production landscape with enterprise clients and it gives confidence to customers to enable a smooth hybrid integration. Mostly all the features in this release are stable and running fine.
 
In the list of all available new features, REST APIs is the newest feature that will help customers to manage their different-different artifacts in BizTalk Server environments.
 
If you want to learn more about other new features available in BizTalk Server 2020, please visit the below link where a list of all videos and articles are available.
 

How to Configure the REST API in BizTalk Server 2020

 
REST API feature is coming with BizTalk 2020 and we can configure it using the BizTalk Configuration Wizard. Once we install BizTalk 2020, we will have two ways to configure the BizTalk Server (Basic configuration & Custom configuration. These are part of the basic installation and configuration part of the BizTalk server, and in this article; we will not discuss it in depth). Using Basic configuration, you do not have to do much, and simply providing the DB Server + UserName + Password will be enough to configure. Moreover, in case you see any error then based on the log you can correct and reconfigure it. Let's see what are the steps you have to follow for Custom configuration,
  • Enable BizTalk REST APIs => Select this checkbox to configure REST APIs
  • Web service accounts => Use the account that is configured to run IIS services.
  • Windows groups => BizTalk REST APIs use Windows authentication, enter the Windows groups allowed to access the APIs here.
  • REST APIs website => Choose the Website to host these REST APIs.
 
After all configurations are placed properly click on Apply configuration to complete the BizTalk Server configuration. When it completes, your configuration more or less will look like the below screen.
 
 
Now that your REST APIs are configured, let's check the final stage to validate everything is working as expected.
 
Open Internet Information Services (IIS) and expend Sites => Default Web Site;
 
You could see the below 2 applications should be listed there,
  1. BizTalkManagementService
  2. BizTalkOperationalDataService
 
For both the applications, there will be separate App Pools created. Using the REST APIs configuration all the endpoints are added with swagger definition. We can access the definitions of all configured managed APIs. With the help of Swagger definition, we can understand the input & output parameters of each method. In addition, it will help us to test API methods. Let's try to browse the managed APIs using the below link,
 
http://localhost/BizTalkManagementService/swagger
 
 
We are successfully able to browse and check the definition of APIs, which means we are good to go for the next step.
 
Sometimes, the user has faced the issue during browsing the endpoint and they may see the below error,
 
Do not worry, let's fix it quickly, and then we will move to the next step. Error is saying, "HTTP Error 401.2 - Unauthorized"
 
We have to check the authentication of these applications,
 
 
Here, as per the screenshot, Windows Authentication is disabled and we have to enable it. We will enable and let's refresh/reopen the above link.
 
 
It worked and we are able to check all the definitions of APIs.
 
 

What can we do with this feature?

 
Using these Management Service APIs, we can manage the different artifacts in our BizTalk Server environments. Management APIs will give options to remotely update, add, and query the status of different artifacts in the BizTalk Server environment.
  • Agreements
  • Applications
  • Batches
  • BusinessProfiles
  • FallbackSettings
  • Group
  • HostInstances
  • Hosts
  • OperationalData
  • Orchestrations
  • Parties
  • Pipelines
  • Policies
  • ProtocolTypes
  • ReceiveLocations
  • ReceivePorts
  • Resources
  • RoleLinks
  • Schemas
  • SendPortGroups
  • SendPorts
  • Transforms
Let's check the details of the application, we will use GET/Application to pull the information. In the below screenshot, we will understand the definition model along with Curl & Requested URL. Click on Try it out! and get the details of the application in response.
 
REQUEST
 
 
RESPONSE
 
 

Conclusion

 
There are several other advantages to using REST APIs, it will help to manage the environment remotely using it with full Swagger support.