2.7 Get rescan tasks

Request

Value

Method

GET

URL

https://api.metadefender.com/v4/file/schedule

Summary

Get the list of active rescan tasks for a given apikey. This covers the periodic rescans that were scheduled using the /v4/file endpoint.

Request

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 request:

{
"tasks": [
{
"id": "U7d38kLrjIuwl-z6zuCXc1617704943481",
"count": 2,
"interval": 60,
"next_scan_ts": "2021-04-06T10:29:03.482Z",
"number_of_scans": 1,
"last_error": "",
"scan_headers": {
"filename": "testfile"
},
"scan_dataids": [
"d4d28kPrjIuw"
]
}
]
}

Descriptions of responses:

tasks

Array of currently active rescan tasks

id

Id of a given rescan task (equals to the file_id which was created during the initial scan)

count

How many times the file is scheduled for rescan

interval

How many hours should elapse between two consecutive scans

next_scan_ts

Approximately when the next scan is going to start

number_of_scans

How many scans were completed so far

last_error

Details about the last scan error (if there were any)

scan_dataids

Array of the data_ids belonging to the scans which were completed so far

scan_headers

Headers used for rescan requests (matches the headers for the initial scan)

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",
"schedule"
],
"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/schedule \
-H "apikey: ${APIKEY}"