Webhooks
To avoid spamming the /jobs endpoint you can subscribe to a webhook for several events. Add the webhook
field to your Job object in the request body when creating a new job:
{
"sources": ["{url-to-your-image}"],
"modules": {
"face_recognition": {
"model": "celebrities"
}
},
"webhook": {
"events": ["job.face_recognition.on_completed"],
"callback": "{your-endpoint-url-to-receive-callback}"
}
}
The event names follow a hierarchical path structure, with each component separated by a dot.
{namespace}.{event_name}
The path consists of multiple parts: the namespace as path and the specific event name.
By combining these elements in a dot-separated format, the event names provide a clear and structured way to organize and refer to different events within DeepVA
The following events are available:
- on_completed - job is done and has a final result
- on_started - job has started. DeepVA is analyzing it
- on_failed - job has failed
- on_detailed_result - job has submitted a single result (DetailedResult)
There are more specific events on the mining module level:
- job.landmark_recognition.on_segment_start - Landmark segment started (landmark appeared in the live stream)
- job.landmark_recognition.on_segment_end - Landmark segment ended (landmark disappeared in the live stream)
The following example shows the request body that DeepVA sends to your exposed endpoint:
{
"event": "job.face_recognition.on_completed",
"timestamp": 1574251637.832497,
"data": {
"job": {JOB_OBJECT}
}
}
You can read the job
property to get the completed job.