What is the difference between Webhooks and a REST API?

Asked

Viewed 3,003 times

7

In a API REST We define a resource to receive data and then return some response. And to send a message to a webhook, we make a request and also receive a reply (depending on the case).

You both do the same thing? So what’s the difference? It’s just conceptual or implementation?

2 answers

6

What is a Webhook?

A Webhook is an HTTP endpoint from which a client must implement to receive notifications of events occurring on a server.

They both do the same thing?

No. In a REST API, the server exposes a set of services via HTTP endpoints. In a Webhook, the client exposes an HTTP endpoint and subscribes to the server to receive event notifications.

So what’s the difference?

The difference is that the client consumes the server’s REST API directly through HTTP requests while the Webhooks are HTTP requests that the client should expect.

3


A Webhook is a service, API is the set of rules and methods with which we can communicate and use this service. There are webhooks that use a REST type API, others that use custom API, other Graphql, Thrift, etc...

To put it another way:
Webhook is an online service, API is the way to interact with Webhook.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.