Web-hooks VS APIs

APIs and web hooks both allow different software systems to sync up and share information.

Nazhim Kalam
Enlear Academy

--

APIs and web-hooks both allow different software systems to sync up and share information.

What is an API?

An API is like a portal through which information and functionality can be shared between two software services. Usually, we send a particular request to an API endpoint and then use the fetched result to work with our implementation.

What is a web-hook?

A web-hook can be thought of as an API driven by events rather than requests.

Instead of one application making a request to another to receive a response, a web-hook is a service that allows one program to send data to another as soon as a particular event takes place.

Web-hooks are sometimes referred to as “reverse APIs” because communication is initiated by the application sending the data rather than receiving it.

With web services becoming increasingly interconnected, web-hooks are seeing more action as a lightweight solution for enabling real-time notifications and data updates without the need to develop a full-scale API.

Here is an example of a use case,

Say, for instance, you want to receive Slack notifications when tweets that mention a particular account and contain a specific hashtag are published. Instead of Slack continuously asking Twitter for new posts meeting these criteria, it makes much more sense for Twitter to send a notification to Slack only when this event takes place.

This is the purpose of a webhook — instead of repeatedly requesting the data, the receiving application can sit back and get what it needs without sending repeated requests to another system.

--

--

Learning is a never-ending journey be it in college or in life, just enjoy it