here comes a generic question I'd like to answer in the context of different API versions:
I did some research and here's my anser - let's start with some theory besides PTV:Does PTV API have webhooks support?
Case: if we want to send a lot of request that we need to wait to be processed it would be good to receive responses when they are completed back to our system (our API)?
Currently we could achieve that by sending asynchronous requests to PTV and then periodically check if response is ready to be fetched.
But it would require lots of redundant requests to check, when we don't know if request is done yet or not.
It would be more convenient to get response via webhook.
Feature | Webhook | Callback |
---|---|---|
Definition | A webhook is an HTTP-based mechanism that allows one application to automatically send a notification (usually via an HTTP POST request) to another application when a specific event occurs. | A callback is a function that is passed as an argument to another function and executed once a specific task is completed. |
Trigger | Event in an external application | A function within a program |
Communication | Over HTTP (REST API) | Within a code or application |
Execution Type | Asynchronous, over the internet | Usually synchronous or within a code |
Example | A payment service sends a notification about a successful payment | JavaScript setTimeout(() => console.log("Done!"), 1000); |
Wikipedia (en) | Wikipedia: Webhook | Wikipedia: Callback |
From my understanding
- the support of webhooks would require dedicated features on "server side" - which we did not implement so far in our APIs.
- Callbacks should be possible but they rely on the client programming approach
Some of our API calls support asynchronous methods (start... watchprogress... fetch) as alternatives to (start..........remain blindfolded for an unknown period.... tadaaa: first feedback ever is the result). Check this article about Bulk Operations
Important to know:
- Though we do not suport webhooks natively, some of the methods allow you to create a feedback/progress statement
- Example: Batch Geocoding in PTV Developer