Calling SQL Server With HTTP Webhooks

In this article, I will introduce you to Enzo Online’s SQL Server webhook, a free service you can use to call a SQL Server database hosted in the cloud using HTTP commands so that you can easily program against a relational database using simple HTTP commands.

The ability to use a light-weight HTTP/S endpoint (called a webhook in this article) to access database tables removes the need to build a dedicated middle-tier application; the webhook becomes a form of a middle tier in itself. If you build a two-tier application, the webhook removes the need to use a client-side library to connect to the SQL Server, which means you can call SQL Server from any operating system exactly the same way.

Configuration

The SQL Server webhook is hosted by Enzo Online. In order to configure Enzo Online for webhook access to your database, you need to configure two components: a Connection String, and a SQL Server service. Creating the connection string is pretty straight forward; all you need is the Azure SQL Database connection string to your database.

Calling SQL Server With HTTP Webhooks 

Once the connection string has been created, you can then create a SQL Server service in Enzo Online as well, selecting the connection string you previously created. And you are pretty much configuring Enzo Online. You can now make SQL requests to your database using HTTP commands.

Calling SQL Server With HTTP Webhooks 
 

Trying the Webhook

In order to make HTTP calls to Enzo, you will need two pieces of information: the Enzo Instance URL, and the Enzo Auth Token. Both can be found in the Enzo Accounts menu.

Calling SQL Server With HTTP Webhooks 

Let’s test SQL Server access using Fiddler, a popular HTTP debugging tool. Start Fiddler and click on the Composer tab. Under the Parsed tab, enter the following information.

HTTP TypeGET
URLhttps://daas001.enzounified.com/bsc/sqlserver/run
HeadersauthToken: YOUR_ENZO_AUTH_TOKEN_config: azuredbsql: SELECT name FROM sys.tables

Calling SQL Server With HTTP Webhooks

Et voila… you will obtain a JSON response from Enzo Online of the result returned by your command. It is really that simple. Since you are getting back a JSON document you can easily parse the response regardless of the application programming language (node.js, C#, Python…).

Calling SQL Server With HTTP Webhooks 

In fact, you can pass all the parameters as an HTTP query, like this, and use your browser directly:

https://daas001.enzounified.com/bsc/sqlserver/run?_config=azuredb&sql=SELECT name FROM sys.tables&authToken=YOUR_AUTH_TOKEN  

Calling SQL Server With HTTP Webhooks 

Accessing a SQL Server database hosted in the cloud using a webhook platform makes development much simpler since there is no need to build a middle tier service to access the database. Webhook based development can help with a large number of application development projects, including IoT and mobile development.