user06931912
user06931912

Reputation: 39

How can I see the output from .Q.hg/.Q.hp?

I am using .Q.hp to send a message to symphony bot .

.Q.hp[hsym`$"host";"";"chatRoomName;someHTMLTable"]

If I run the above in the browser I usually get something back like "duplicate message" or "room does not exist", but .Q.hp only returns an empty string ""

How can I see if a message is being received from the alert bot? Is .Q.hp asynchronous and is kdb not waiting for anything back?

Upvotes: 0

Views: 109

Answers (1)

terrylynch
terrylynch

Reputation: 13572

You can make a custom .Q.hp2 that returns a response which is a two-item list (of strings) - by default .Q.hp only returns the second item in that list. The first item in the response might give you the info you're looking for.

q).Q.hp2:{.Q.hmb[x;`POST;(y;z)]}
q)res:.Q.hp2["http://google.com";.h.ty`json]"my question"
q)res 0
"HTTP/1.1 405 Method Not Allowed\r\nallow: GET, HEAD\r\ndate: Wed, 15 Dec 2021 02:09:14 GMT\r\nco..
q)res 1
"<!DOCTYPE html>\n<html lang=en>\n  <meta charset=utf-8>\n  <meta name=viewport content=\"initial..

Tested with v4.0 build 2021.07.12

Upvotes: 1

Related Questions