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}");
}
}



 


Hi ​@Tomasz Grzebula  I tried calling this API with my current latitude and longitude as shown below,
 

but I encountered an error.
 

Could you help me understand how to get a response from this API?


@Lekshmikanth,
According to my experience, apart from very simple examples, httprequest in a client command generally doesn’t work. Additionally it seems to be undocumented feature.


Okay Thankyou ​@Tomasz Grzebula 


@Tomasz Grzebula awesome...

Do you employees have any better/more complete documentation than what is available to Customers?

 


@PhillBronson, I don't have access to any additional documentation. I just found httprequest in this community and in IFS Developer Studio, and have done some experiments. I guess that httprequest is not documented because it simply doesn't work.


@Tomasz Grzebula thanks!

 

curiouser and curiouser.


Reply