REST frameworks were one of the biggest revolutions in the IT industry, REST helps to interchange information smoothly irrespective of any platform.
REST — Platform Independent
Webhook - An application to provide information to other applications. It allows an app to send automated messages or data updates to another app when a specific event occurs.
In the Typical client-server architecture, Vendor API integration has 2 parties involved-
1. Who wants a service called Requestor.
2. Who will serve the service called as a provider/Responder.
let’s take an example where in the E-commerce industry if a merchant wants to register the products on any E-commerce platform such as Amazon, Flipkart, Myntra, etc., the integrations are required between both systems. consume vs expose the webhook to execute the CRUD operation's respective event.
Who needs to consume the webhook?
Who needs to expose the webhook?
When the Merchant wants to register the product on the Amazon platform then Amazon has to design and expose the “Register” API and merchant should consume the same because CTA is from the merchant's end only and Merchant knows by when he wants to register the new product.
In vice versa, if we can say Merchant will create the post API to send the new product details and Amazon will consume the same then in that case server resources will not get utilised properly.
Yes, There is various way to achieve the goal but resource utilization, security, performance, and feasibility are a major concern that needs to be taken care of.
Importance of Webhook/callback API-
Let's consider 2 parties- Party “A”-is the PG (payment Gateway) and B is the merchant who has integrated the PG.
So the scenario is- if Party “A” has initiated the payment and waits till UTR not received from PG i.e from “B”, but “B” takes time to generate the UTR (not fixed TAT), in this case, Party “A” has to create and expose the webhook(callback) API with party “B” and B will trigger the webhook once the UTR generated successfully.
But most places take the wrong approach and recommended as Party A has to call the Party B GET API frequently. In this case, both parties' resources are not getting utilized very well.
Hopefully this will helps you to understand as who should write the API and importance of webhook call.
Thanks!
Comments