Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 507
ColinMac Avatar asked Oct 27 '25 16:10

ColinMac


1 Answers

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

like image 90
Geraldo Diaz Avatar answered Oct 29 '25 07:10

Geraldo Diaz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!