Avatar of deanmachine333
deanmachine333Flag for United Kingdom of Great Britain and Northern Ireland

asked on 

Import Web API into sql server table every minute easily

Hello ,

Im trying to find a quick easy way to import the results from a Web API into a sql server database , which will run every minute?

the example of the API is the following

https://bittrex.com/api/v1.1/public/getmarketsummaries   

Can anyone advise on this please?

Thanks
DatabasesMicrosoft SQL ServerRESTSQL

Avatar of undefined
Last Comment
deanmachine333
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

what version of MS SQL are you using?

are you consider to use SSIS or a custom ETL program to import the data to MS SQL?
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

You can create a stored procedure

and call the stored procedure using SQL Job with 1 minute interval.
Avatar of deanmachine333
deanmachine333
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

Hello Ryan,

I prop be using SQL Server 2016 and i could use SSIS , im just trying to see what the quickest and easiest way to get the output from the API into a sql server table.

Ive seen this product online which is what im looking to achieve
https://api-db.com/
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

SQL Server Proc will be the fastest. SSIS will also internally call SQL only.
Avatar of deanmachine333
deanmachine333
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

@Pawan hiya, can you advise using the example API how the code would be achieved, please?
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

In fact you can the web API directly from SQL Server itself. See if this works for you https://www.mssqltips.com/sqlservertip/3495/extracting-api-data-using-powershell-and-loading-into-sql-server/
Avatar of deanmachine333
deanmachine333
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

@Pawan can you advise the sql code to achieve this please?
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

you may customize and do some test from the methods mentioned in this article:

Consuming JSON Formatted API Data in 2016
http://www.sqlservercentral.com/articles/JSON/141175/
SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Daniel_PL
Daniel_PL
Flag of Poland image

Hi,

If you want to use code from inside SQL Server by using Ole Automation you need to enable it first, by default it is disabled.
sp_configure 'show advanced options', 1;  
GO  
RECONFIGURE;  
GO  
sp_configure 'Ole Automation Procedures', 1;  
GO  
RECONFIGURE;  
GO  

Open in new window


However, I suggest to use Powershell type of SQL Server Agent Job. I find it more stable and secure than going out with Ole Automation.

Regards,
Daniel
ASKER CERTIFIED SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of deanmachine333
deanmachine333
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

@david thanks i got it working with that code ( few mods but working huge thanks ) what would you advise for me to run the powershell script every minute?
SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
Avatar of deanmachine333
deanmachine333
Flag of United Kingdom of Great Britain and Northern Ireland image

ASKER

thanks got it working with Davids solution.
Microsoft SQL Server
Microsoft SQL Server

Microsoft SQL Server is a suite of relational database management system (RDBMS) products providing multi-user database access functionality.SQL Server is available in multiple versions, typically identified by release year, and versions are subdivided into editions to distinguish between product functionality. Component services include integration (SSIS), reporting (SSRS), analysis (SSAS), data quality, master data, T-SQL and performance tuning.

171K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo