Welcome! Log In Create A New Profile


Curl to WinDEV

Posted by SteveSitas 
Curl to WinDEV
September 05, 2020 10:32AM

what would be the OPTIMAL way to translate the following curl lines to WINDEV 25?


curl -v -X POST "[mydata-dev.azure-api.net];
-H "aade-user-id: {aade-user-id}"
-H "Ocp-Apim-Subscription-Key: {subscription key}"

--data-ascii "{body}"


the first line is the "address: of the RestAPI
the 2nd and 3rd line are the username and the password
the 4th line is the actual data to be POSTed (XML structure - comes from an XSD)

Steven Sitas
Re: Curl to WinDEV
September 07, 2020 04:56PM
Try this:
myRequest is httpRequest;
myRequest..URL = "mydata-dev.azure-api.net";
myRequest..Method = httpPost;
myRequest..Header["aade-user-id"] = "aade-user-id";
myRequest..Header["Ocp-Apim-Subscription-Key"] = "subscription key";
myRequest..Content = "body";
myResponse is httpResponse = HTTPSend(myRequest);
IF ErrorOccurred THEN
Re: Curl to WinDEV
September 07, 2020 08:29PM
Hi Adelo,

thanks for the code

Steven Sitas
Peter Holemans
Re: Curl to WinDEV
September 08, 2020 10:02AM
Hi Steve

As curl is targeted at REST services you might use the RESTRequest and RESTResponse variables instead.

Best regards

Peter H.
Re: Curl to WinDEV
September 08, 2020 06:51PM
Hi Peter,

yes I am using the code ADELO posted above and it works fine - he is using RESTRequest and RESTRespone ...
Previously I tried to do authorization with myRequest..user and myRequest..password in the REST request and ofcourse it didn't work.
You need to pass "aade-user-id" and "Ocp-Apim-Subscription-Key" in the header to make things like this to work

Steven Sitas

Your Email:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.