Call a Web Api 2 endpoint from a stored procedure

Viewed 26613

some legacy SQL stored procedure (SQL Server 2008) needs to get some information from a web service (Web Api 2) that I provided.

How to call the endpoint (in GET), retrieve the data (JSON format) and translate the data received in a temporary table to be used in the rest of the sproc?

Thanks

3 Answers

Try using this CLR Stored procedure: SQL-APIConsumer

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