Question
Rochdi Badis · May 7

HTTP request using a curl

Hi guys,

 

How do I create a make a http request using curl, I've found samples on how to do it from a command prompt but how to create and make a http post request and get a response with ensemble object and functions?

I guess somthing like :

s req=##class(%Net.httpRequest).%New()

...etc

Or do I build a command run it in ensemble and get a response back, if so how can I do that ?

 

Thanks

 

Product version: Ensemble 2014.1
0
0 144
Discussion (2)2
Log in or sign up to continue

Hi Rochdi! curl is a software that can make http calls from a command line. 

Are you sure you need curl? Or maybe you need to make http calls from IRIS or Ensemble? 

There are plenty of examples.

E.g. here is a one line to make an http GET request and download  and install ZPM:

    s r=##class(%Net.HttpRequest).%New(),r.Server="pm.community.intersystems.com",r.SSLConfiguration="ISC.FeatureTracker.SSL.Config" d r.Get("/packages/zpm/latest/installer"),$system.OBJ.LoadStream(r.HttpResponse.Data,"c")

It is an example of http request

You could invoke curl using $zf(-100), where you'd make the call redirecting the response to a file.  After the call completes, you can read the contents of the file into a string or stream.