Link to home
Start Free TrialLog in
Avatar of John Esraelo
John EsraeloFlag for United States of America

asked on

SQL: cURL calls::

Hello team,

Is it possible to call cURL http/s calls from within sql server 2008 using TSQL?
> are there prerequisites and what are those
>do I need to install PHP or some client / modules/etc in order to run the curl command line statements
>what are pros and cons of using

One of our third parties have provided us with the API routines but before I start my questionings them wanted to get an idea from you guys first and see what you think.
thx

JohnE
ASKER CERTIFIED SOLUTION
Avatar of Dave Baldwin
Dave Baldwin
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I'm sorry for sounding abrasive, but applications are responsible for communication between data stores...not the data stores themselves.

So, if your third party has provided you with an API, then they are expecting that you will create or have a supporting application in place that will provide the desired calls out to the remote service.

~AB
Avatar of John Esraelo

ASKER

Adrian,
sql server can actually make an xp_cmdshell execution if I am not mistaken.  However, I am not sure about the rest of it and that is something that I would probably need to communicate with them, but, here today, I wanted to get a general thoughts here and collect knowledge.
Dave,

I believe you are on the money.  I have tried something and did work in tsql. However, for some reason I am getting auth failure and working on that right now .
Thank you Dave.
The only reason I stated what I did, was because database servers should be strictly just that. In a proper n-tier architecture, database servers should never take on the load of handling cross domain communications. Not even intra-domain communications, except in very limited circumstances.

The application layer is wholly responsible for all aspects of data transportation. Just because a database server supports that functionality certainly does not justify breaking best-practices in favor of using it.

I can understand SQL Server's ability to ACCEPT remote calls as the end result is a formatted dataset, but to make outgoing calls just totally goes against the grain of the intended design of a database server.

I wish you luck if this setup is to be used in any level of enterprise capacity.

~AB
I tend to agree with Adrian.  Although it is doable, I don't think it is a particularly good idea and I would always use cURL from my application, not my database.