API Services vs API Event Handlers

I just completed the Cloud Coder tasks in Missions, which deal with API Services and API Event Handlers.

But as I don’t have prior experience coding apps, I still don’t feel like I understand what the roles of these two categories are.

api-services-versus-api-event-handlers

The examples in the Missions videos helped, but I don’t feel like I’ve got a sense of the bigger picture yet.

Can somebody please explain how their purposes differ, and maybe include some more usage examples?

Thanks.

API Event Handlers - (as the name suggests) react on a specific event, e.g. you save some data in database (Data section), and you want to perform additional logic before or after that event, or you want to check whether you need additional logic at all.

API Services – is a independent peace of code, which you save on our side and can call directly or indirectly (as an external call, or from the page logic, or even from Event Handleer)

1 Like

Thank you, that is helpful.

So if I understand correctly…

  • Event Handlers are watching for something to happen and react
  • Services are bundles of reusable code that can be called from different places

Yes that’s right.