2.6 Retrieving webhook status
Request |
Value |
Method |
GET |
URL |
https://api.metadefender.com/v4/file/webhooks/:dataId |
Summary
After uploading a file with the "callbackurl" header, the status of the webhook callback can be checked using this endpoint. The status can be checked up to 12 hours after the file was uploaded, any request sent after this time period will return not found.
If calling the endpoint without specifying a data_id, the status for all the webhook callbacks in the last 12 hours will be sent back.
Request
URL Parameters
|
Description |
Example |
:dataId |
The dataId received on upload (Optional) I f omitted, returns all the latest webhook calls in the last 12 hours. |
ZTE2MTIyNkhKeGs5WElSNHhIMVFGLVlUYk85LQ |
Header Parameters
|
Description |
Allowed Values |
Required |
apikey |
gives rights to use the endpoint (token authentication) (API Authentication Mechanisms) |
apikey |
YES |
Response
HTTP Status Codes
Please refer to Status Codes for more information.
Body
Example of a successful response for a particular data_id
{
"url"
:
"http://my.company.io/webhook"
,
"status_code"
:
200
,
"data_id"
:
"bzE5MDQwOEgxZVo5bjNfSzRISlpiYzMyZEtW"
,
"request_time"
:
"2019-04-08T12:20:29.346Z"
}
Example of a webhook URL not found response:
{
"url"
:
"http://my.company.io/webhook"
,
"status_code"
:
404
,
"data_id"
:
"bzE5MDQwOEgxZVo5bjNfSzRISlpiYzMyZEtW"
,
"request_time"
:
"2019-04-08T12:20:29.346Z"
}
Example of a successful request without data_id:
{
"data"
: [
{
"url"
:
"http://my.company.io/webhook"
,
"status_code"
:
404
,
"data_id"
:
"bzE5MDQwOEgxZVo5bjNfSzRISlpiYzMyZEtW"
,
"request_time"
:
"2019-04-08T12:20:29.346Z"
},
{
"url"
:
"http://my.company.io/webhook"
,
"status_code"
:
200
,
"data_id"
:
"bzE5MDQwOHJ5ZXgyM25PWU5yMVpsMjJoZEtW"
,
"request_time"
:
"2019-04-08T12:21:00.227Z"
}
]
}
Example when a result is not found:
{
"error"
: {
"code"
:
404001
,
"messages"
: [
"Entity was not found"
]
}
}
Descriptions of responses:
URL |
The webhook callback URL sent when uploading the file |
status_code |
The response received back from calling the webhook |
data_id |
The data_id of the response sent |
request_time |
The time when the webhook was called |
Errors
Please refer to Errors for more information.
Sample code (Node.js)
var http = require(
"https"
);
var options = {
"method"
:
"GET"
,
"hostname"
: [
"api"
,
"metadefender"
,
"com"
],
"path"
: [
"v4"
,
"file"
,
"webhooks"
,
"ZTE2MTIyNkhKeGs5WElSNHhIMVFGLVlUYk85LP"
],
"headers"
: {
"apikey"
: process.env.APIKEY
}
};
var req = http.request(options, function (res) {
var chunks = [];
res.on(
"data"
, function (chunk) {
chunks.push(chunk);
});
res.on(
"end"
, function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});
req.end();
Sample code (cURL)
curl -X GET \
https:
//api.metadefender.com/v4/file/webhooks/ZTE2MTIyNkhKeGs5WElSNHhIMVFGLVlUYk85LP \
-H
"apikey: ${APIKEY}"