0

i am looking for a way to call a HTTP request(web-hook) from MySQL when any field is updated in a table.

Is there a way to do it using MySQL function or trigger?

Script47
  • 14,230
  • 4
  • 45
  • 66
rahul
  • 880
  • 3
  • 14
  • 25
  • Which server side scripting are you using for http response and how you are updating database values? – Nitin Dhomse Jan 28 '19 at 09:00
  • i am using java spring but how does it matter and mostly i am updating using mostly java but i want the request to be sent from mysql server – rahul Jan 28 '19 at 09:02
  • 2
    Possible duplicate of [MySQL trigger to send HTTP POST request](https://stackoverflow.com/questions/47936519/mysql-trigger-to-send-http-post-request) – Roshana Pitigala Jan 28 '19 at 09:03
  • You are updating value through a Java api, so you will have a success status for insert / update operation, you need to broadcast http request using web socket from server to client on update success OR you want to use it like webhook, you can call the required url / api as well – Nitin Dhomse Jan 28 '19 at 09:05

1 Answers1

0

I don't think that you can call HTTP request from MySql,

but you can use calling scripts from triggers with UDF. I think that it possible since MySql 5.5 ... but please check and verify

https://dev.mysql.com/doc/refman/5.7/en/faqs-triggers.html#faq-mysql-can-triggers-udf

Invoking a PHP script from a MySQL trigger

and then you will invoke some code and there you will make the HTTP request or what ever you need.

shushu304
  • 1,506
  • 1
  • 7
  • 15