Events

For requests or help with our API
Post Reply
User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Events

Post by jordansparks » Thu Jan 20, 2022 10:21 am

Our current API has no events. It has come to my attention that various 3rd parties depend heavily on events for their functionality. So far, I'm aware of two strategies:
1. MySQL triggers added to the db. When a trigger fires, this runs a query or multiple queries.
2. Plug-in that responds to certain things happening in the UI. This also runs queries, either by calling OD code or directly.
So both of the above are making changes to the database. Both are being used by third parties in a manner that is more complex than I had imagined.

We cannot push developers onto the API until we can fully replace all their existing functionality. That means that we need to back off a little bit and work harder on building a better API.
Jordan Sparks, DMD
http://www.opendental.com

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: Events

Post by jordansparks » Fri Jan 21, 2022 7:25 am

We are making good progress on Events. One fundamental problem that I still can't quite figure out is that databases don't inherently generate events that are consumable externally. That means we will still need to poll the db at a certain interval in order to generate database events. But I think we can be blazing fast at generating events that happen when a user in the UI clicks a button for example. No need for polling there. Looks like all the events will be webhooks, which can be extremely short strings that are easy to digest. I hope that all made sense. I just woke up.
Jordan Sparks, DMD
http://www.opendental.com

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: Events

Post by jordansparks » Sun Feb 06, 2022 8:51 am

Events are functional and will be in version 22.1. So you subscribe to an event
https://www.opendental.com/site/apisubscriptions.html
and now it fires off to your chosen end point. It's pretty cool.

The next step, which I hope to have done before the end of the weekend, is UI events. Push a button or open a form in Open Dental, and a subscribed event fires off to your endpoint, whether that is on localhost or on some web server. These web hooks will replace all the existing plugin hooks.

I think it would also be nice if the local API could receive special kinds of REST methods from 3rd parties that would cause things to happen in the UI. An example is ModuleSelected(patNum).
Jordan Sparks, DMD
http://www.opendental.com

User avatar
jordansparks
Site Admin
Posts: 5739
Joined: Sun Jun 17, 2007 3:59 pm
Location: Salem, Oregon
Contact:

Re: Events

Post by jordansparks » Mon Feb 07, 2022 3:13 pm

I did get the first UI event to fire. This event fires every time you change patients, and it tells you who the new patient is.
Jordan Sparks, DMD
http://www.opendental.com

SriramChellappan
Posts: 42
Joined: Thu Mar 11, 2021 2:45 pm

Re: Events

Post by SriramChellappan » Thu Jun 16, 2022 9:33 am

Have you considered looking into DB replica logs to capture the changes in DB.

Post Reply