Query Rest API with kdb+

My first post is going to be a light one. Today, I would like to share with you a useful tip. In my case, I have always struggled with kdb+ to use any Rest API, until I got this code working.

httpGet:{[cmd] (`$":http://hostname:port")"GET ",cmd," HTTP/1.0\r\nHost:hostname\r\n\r\n"};
res:httpGet[ "/entry/point" ];

In this code, we are setting a handle to the API host with a GET method. Note that POST would work too. The text following the handle is the header of the query. This function is an alternative version of curl where one can query any URI he would like.
More