Is it possible to send http request to a web api from posgresql databse? I will create a trigger and it will post a requet to an http api when a new record created.
Asked
Active
Viewed 131 times
0
-
1There is no built-in method for doing that. And doing that in a triggers seems like a bad idea as well. – Jan 15 '18 at 11:20
-
You can write a PL/PerlU or PL/Python function that does such things, but I would not do that in a trigger. – Laurenz Albe Jan 15 '18 at 11:43
-
You can do something like [this](https://gist.github.com/movEAX/d128a9602cf93e3dba2e): push the event to a ZMQ socket and then write a listener in any language which supports ZMQ (pretty much any language). And that listener will send the request to the API. – Dmitry Jan 15 '18 at 12:20
-
I never used it so far but there is a foreign data wrapper for WWW - https://github.com/cyga/www_fdw - check it. To me it looks like something you could use. – JosMac Jan 15 '18 at 13:08
-
@JosMac Can I post it to msmq or rabbitmq like this? – barteloma Jan 15 '18 at 13:18
-
Could you please add example(s) of post request(s) for them into your original question? – JosMac Jan 15 '18 at 13:22