Skip to main content

Could I get a “Hello World” example of how to make an httprequest in a client command? I’m trying to do something like this:

 

 

Hi @durette,
Were you able to run the  httprequest in a client command? 

I was not able to run your “Hello World” example using https://postman-echo.com/get. I encountered the same problem when trying to use the example address below:

httprequest "https://api.open-meteo.com/v1/forecast?latitude=52.2298&longitude=21.0118&current_weather=true"

In debug console (DevTools) I see CORS error.

 

What worked for me were only the very simple examples below:

command TestCommand1 for Xyz {
execute {
httprequest "https://jsonplaceholder.typicode.com/posts/1" into ResponseText {
redirect = true;
method = GET;
header "Accept", "application/json";
}
info("${ResponseText}");
}
}

 

command TestCommand2 for Xyz {
execute {
httprequest "https://httpbin.org/post" into ResponseText {
redirect = true;
method = POST;
header "Content-Type", "application/xml";
body "<note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend!</body></note>";
}
info("${ResponseText}");
}
}



 


Reply