2.4 Rescan multiple files

Body (payload)

Request

Value

Method

POST

URL

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

Throttled

Yes

Summary

Invoke rescan of an array of files.

By default will be set on the low priority queue.

Use Cases (used by)

MetaDefender Cloud rescan already scanned files

Request

Header Parameters

 

Description

Allowed Values

Required

apikey

gives rights to use the endpoint (API Authentication Mechanisms)

apikey

YES

Content-Type

specify the http content type

application/json

YES

samplesharing

only working for paid users - allow file scans to be shared or not

0 / 1

NO

Body (payload)

 

Format

Required

Example

HTTP Body

json

YES

{
"file_ids": ["54fa9de940134850a72ecbf65c2dfe72", "54fa9de940134850a72ecbf65c2dfe72", "e9a50107c3414aeca6d791de6fc742c2", "18856de8d0b94c05ae74fde67ce106f5"]
}

Response

HTTP Status Codes

Please refer to Status Codes for more information.

Body

Example of a successful rescan request:

{
"data": [
{
"data_id": "bzE5MDIyN1N5OHhZcnkwWFVWSHlEZ1lCMTBYSTQ",
"status": "inqueue",
"in_queue": 1,
"queue_priority": "normal",
"file_id": "54fa9de940134850a72ecbf65c2dfe72"
},
{
"data_id": "bzE5MDIyN0JKWXhZSDEwN0xOcjE1eFlIa1JtVTQ",
"status": "inqueue",
"in_queue": 1,
"queue_priority": "normal",
"file_id": "e9a50107c3414aeca6d791de6fc742c2"
},
{
"data_id": "bzE5MDIyN0IxUnhZcjFDN0w0U0prV0Zya0FYVVY",
"status": "inqueue",
"in_queue": 1,
"queue_priority": "normal",
"file_id": "18856de8d0b94c05ae74fde67ce106f5"
}
]
}

Example of a failed rescan request:

{
"data": [
{
"file_id": "54fa9de940134850a72ecbf75c2dfe72",
"code": 404007,
"err": "Requested file id does not exist in our records",
"status": 404
}
]
}

Descriptions of response:

data_id

Used for retrieving scan results. Since multiple scans can potentially be performed for the same files when any engine has a different definition time or when there is an additional engine, this is the identifier for per-scan rather than per-file.

status

Status of the scan request. Value inqueue represents the state, when the scan is being queued for scanning.

in_queue

Counter representing the total numbers of files in the queue at the time of the request.

queue_priority

The priority of the file in scanning. Free users have normal priority, and paid users go to high.

Errors

Please refer to Errors for more information.

Sample code (Node.js)

var http = require("https");
 
var options = {
"method": "POST",
"hostname": [
"api",
"metadefender",
"com"
],
"path": [
"v4",
"file",
"rescan"
],
"headers": {
"apikey": process.env.APIKEY,
"Content-Type": "application/json"
}
};
 
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.write(JSON.stringify({ file_ids:
[ '54fa9de940134850a72ecbf65c2dfe72',
'54fa9de940134850a72ecbf65c2dfe72',
'e9a50107c3414aeca6d791de6fc742c2',
'18856de8d0b94c05ae74fde67ce106f5' ] }));
req.end();

Sample code (cURL)

curl -X POST \
https://api.metadefender.com/v4/file/rescan \
-H 'Content-Type: application/json' \
-H "apikey: ${APIKEY}" \
-d '{
"file_ids": ["54fa9de940134850a72ecbf65c2dfe72", "54fa9de940134850a72ecbf65c2dfe72", "e9a50107c3414aeca6d791de6fc742c2", "18856de8d0b94c05ae74fde67ce106f5"]
} '