ColinMac
ColinMac

Reputation: 640

Can I call a Web API from SQL Server?

I want to send an HTTP GET call to an API every hour. I want this data directed to my SQL Server database (or MySQL). I'm a data guy, not a web developer.

Is it possible to make this call using SQL Server? If so, how? If not, what's the easiest workaround?

Upvotes: 4

Views: 28415

Answers (1)

Geraldo Diaz
Geraldo Diaz

Reputation: 356

Sure it's as simple as this;

     exec  [dbo].[APICaller_POST]
     @URL = 'http://localhost:5000/api/auth/login'
     ,@BodyJson = '{"Username":"gdiaz","Password":"password"}'

After you deploy this CLR Stored procedure: https://github.com/geral2/SQL-APIConsumer

It has multiple procedures that allows you calling API that required a parameters or even passing multiples headers and tokens authentications.

enter image description here enter image description here

Upvotes: 10

Related Questions