Closed chambbj closed 7 years ago
Some models to consider:
I've implemented django-rest-hooks for v3 of the API. Currently it supports subscribing to newdata notifications and export completion notifications, but at a global level instead of individual.
Is that sufficient or should we discuss callbacks at an individual export parameter as well?
If there are any other GRiD features that you would like callbacks for feel free to include them here.
newdata and export completion were the obvious use cases.
Not sure what you mean by "global". Like every event global? Or every event related to my registered application? If the latter, I think that's fine. The application can filter out which AOI received newdata, which export completed, etc. If you mean truly global, that seems like overkill.
Yeah sorry let me clarify. It only applies to your user. So if you register for a newdata.loaded event, you'll get a notification any time one of your AOIs intersects a new data load. Likewise if you register for export.complete, you'll be notified for all of your own exports that finish (success or failure).
Webhook callbacks have been added to v3 via the hook endpoint. They support global events for the user or can be narrowed down to only trigger for specific AOIs for the user.
A new, optional parameter
callback_url
should be supported, that reports back to the caller when processing has completed (success or failure) for long running tasks such as export generation. Response should be a JSON-encoded export object, which already includespk
of the export,task_id
, andstatus
, along with full information of the exported dataset, thus obviating the need to reach back in through the API to gather such data, at least for successful exports. For failed exports, the user can ping the/task
endpoint to retrieve any availabletask_traceback
.