2.3 Rescanning a file

Request

Value

Method

GET

URL

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

Throttled

Yes

Summary

Rescan a previously uploaded file using its "file_id" (see below). If the previous scan was done with the "samplesharing" flag disabled, this is not available. Once a rescan request is made successfully, the scan result can be retrieved in the same fashion as when a file is uploaded.

When we get a scan result from an engine from MetaDefender Cloud, if the scan result is dirty, all non-English characters in the threat name will be removed right away.

Request

URL Parameters

 

Description

Example

:fileId

get from retrieving scan results

bzE5MDEyM1NKZmxDRjY2SG1F

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:

{
"data_id": "bzE5MDEyM1NKZmxDRjY2SG1FSDF1ZXBoTnBtOEU",
"status": "inqueue",
"in_queue": 2,
"queue_priority": "normal"
}

Example of a failed request:

{
"error": {
"code": 404007,
"messages": [
"Requested file id does not exist in our records"
]
}
}

Descriptions of response:

data_id

The identifier used to retrieve 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": "GET",
"hostname": [
"api",
"metadefender",
"com"
],
"path": [
"v4",
"file",
"bzE5MDEyM1NKZmxDRjY2SG1F",
"rescan"
],
"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/bzE5MDEyM1NKZmxDRjY2SG1F/rescan \
-H "apikey: ${APIKEY}"