1. Anoop Anand
  2. PowerBuilder
  3. Monday, 27 November 2023 13:59 PM UTC

I have to call an api based on a table update for only some scenarios. The API endpoint needs to update a table in a different database. I want to put that API call in a trigger. How can I call an API endpoint from a trigger?

Andreas Mykonios Accepted Answer Pending Moderation
  1. Monday, 27 November 2023 14:27 PM UTC
  2. PowerBuilder
  3. # 1

Hi.

This is not a SQL Anywhere support forum. You should ask your question to the appropriate forums that SAP has for SQL Anywhere.

That said, I don't believe you can have a trigger directly doing that. But, you can have a CLR (.NET) or JAVA, javascript, php, perl procedure or function doing that. You can experiment to call that procedure from your trigger. But you must have in mind that a trigger will keep a lock to the table - row(s) that called it until it completes. So, I don't know what exactly you want to achieve, but calling a web api from a trigger, even indirectly, I don't think it's a good idea especially if your web api can take to long or even timeout.

Andreas.

Comment
  1. Anoop Anand
  2. Wednesday, 29 November 2023 12:26 PM UTC
Thanks Andreas.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 27 November 2023 15:45 PM UTC
  2. PowerBuilder
  3. # 2

Hi Anoop;

  For this task with SA, I have always used the "Proxy" table feature instead. This feature is super easy to setup & use from SA to almost any other DBMS or SA instance. HTH

Regards ... Chris 

Comment
  1. Anoop Anand
  2. Wednesday, 29 November 2023 12:26 PM UTC
Thanks Chris.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.