PC SOFT

FOROS PROFESIONALES
WINDEVWEBDEV y WINDEV Mobile

Inicio → WINDEV 2024 → Need help with a Get HttpRequest
Need help with a Get HttpRequest
Iniciado por guest, 07,feb. 2018 19:12 - 2 respuestas
Publicado el 07,febrero 2018 - 19:12
Hello All,

First time trying to call a rest request. I tries code below and got a timed out error.

I have the URL
2 Headers need to be sent
Parameter needs to be sent

I have no Idea how to do this so this is my first attempt

first header - Accept: application/json second header - Authorization: Basic 1233blahblahblah2333333122222==" Parameter - LoadNumber: 3986552 sUrl is string = "http://blahblahblah" IF HTTPRequest(sUrl,"","Accept: application/json" +CR+ "Authorization: Basic 1233blahblahblah2333333122222==") THEN Info("It worked") EDT_Result = HTTPGetResult() ELSE Info("Error") END
Not sure how to format the request. I did test it with a Rest Request test tool and it worked I just need to know how to call it from WIndev

DW
Publicado el 07,febrero 2018 - 19:22
Hi Dennis,

1. each header neads to be gollowed by a CR (you are missing the ending one)
2. parameters should be added to the url, the exact same way they appear in your browser URL area

so you would end up with a URL looking like this:


sUrl is string = "http://blahblahblah"+LoadNumber=3986552

of course, as yo are NOT giving us the TRUE url, I cannot say if it contains the appropriate / and ? that you should have between the domain and the parameters.

Best regards
Publicado el 07,febrero 2018 - 23:50
Thanks Fabticr

Adding the Cr to the end if the header did the trick

DW