For our API this is the workflow we use in short for a Webhook (with a jServer):
API client
subscribes to one of our webhooks
Url: /v1/webhook
Body for POST:
{
"type": "registerRecordManipulation"
"callBackURL": "https://theclientAPI.com/incommingWebhook"
}
-> Insert in a DB the info that this user is subscribed to this webhook
Same to unsubscribe or updating the clients callbackURL. In the header of the call, his "secret_key" determines who he is and if he is allowed to use our API.
Now in action:
Someone updates a record -> We add a record with the update info in a
Queue in the database (if the user is subscribed).
the jServer has a
BackgroundWorker that checks this queue every so much seconds. It then sends the message to the
callbackURL of the client using a resumable sub and
OkHttpUtils2.
We have a system with retries in case his callback server is offline (we also send a mail to him saying it is offline so their IT people can take action).
With B4X, this is very easy to implement because of all the build-in tools we have at our disposal with a jServer.
Alwaysbusy