Published on : Mar 20, 2017
Category : Events
This blog post covers
Episode 11 of Middleware Friday where
Kent Weare talks about Azure Logic Apps and HTTP Connector. In this episode, Kent talks about the improvements to the HTTP Connector. The HTTP Connector has some new VERBS like (GET, PUT, PATCH, DELETE) in addition to existing POST and the introduction of Custom Relative Paths. This makes the connector more ‘RESTful’ and cleaner – being able to perform multiple operations on the endpoint. With these new VERBS, there are definitely advantages when it comes to API Management –
- Without these new VERBS (with only POST), the ability to perform caching on GET requests was literally impossible. Therefore, every time a GET request had to be sent to the system to retrieve the information
- There is no need to change/set the backend URL
The HTTP connector also supports Relative Paths that allows the user to standardize the configuration and treat Logic Apps as Resources.
Demo
To explain the changes to the HTTP Connector, Kent considered the following demo architecture. There will be a device(s) issuing POSTMAN requests to two different Logic Apps that will be exposed (using GET & DELETE). The Logic Apps will be connected to a SQL Azure database.
HTTP GET
Let’s first create the first Logic App that will be exposed. The process to create a Logic App remains the same. Let’s start of with a HTTP Request Trigger. By default, you will be able to define a POST URL. To take a look at the newly added VERBS, click
Show Advanced Options.
You will now see the Method with drop down where you will see the newly listed VERBS and the Relative Path.
For our demo, let’s use the GET method and define the Relative Path to our database (
Person).
You will notice that once you save the Logic App, the HTTP GET URL will automatically get generated. Copy the URL as this is what we will be using in POSTMAN to trigger the request.
Now that we are actually exposing a GET, you can actually provide Query parameters and then retrieve them. Let’s say, we give the ID of the record to be retrieved from the database. In the second step of the Logic App, let’s create the
Get Rows SQL connector to retrieve the values from the database by defining the Filter query.
In the next couple of steps, we will create a
Compose action and the
HTTP Response action to generate the response. The Logic App will finally look as shown below.
To execute this, open POSTMAN and provide the GET URL that you copied from step 1 (in the Request trigger). Replace the ‘ID’ parameter with the ID of the person.
When you click Send, you will see the response coming back from the Azure SQL database with the details of the person matching the entered ID.
/
[adrotate banner=”7″]
HTTP DELETE
in the previous example, we will provide the path parameter (
/Person/{ID}). By doing this, you will be able to access the path parameter in any other connector (in our case the
Execute Stored Procedure connector). The complete Logic App will be as follows –
To execute this, open POSTMAN and provide the DELETE URL that you copied from step 1 (in the Request trigger). Replace the ‘ID’ parameter with the ID of the person. Click
Send and the record will be deleted from the database.
Community Content
Kent highlighted the wonderful effort from the community and pointed out on an
Integration Monday session by Johan Hedberg on “
Continuous Integration for Logic Apps using Team Foundation Team Services“.
Watch the video of this session
You can watch the video of this session on Azure Logic Apps and HTTP Connector below.
Feedback
You can give your feedback about Middleware Friday episodes, any special topic of interest, or any guest speaker whom you would like to see at Middleware Friday. Simply tweet at @MiddlewareFri or drop an email to
middlewarefriday@gmail.com.
You can watch the Middleware Friday sessions
here.
[adrotate banner=”4″]