2.3 Rescanning a file

Request

Value

Method

GET

URL

https://api.metadefender.com/v2/rescan/:file_id

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

:file_id

get from retrieving scan results

b92f5193d01a48a1b6160b16610b6148

Header Parameters

 

Description

Allowed Values

Required

apikey

give rights to use the endpoint (token authentication) (API Authentication Mechanisms)

apikey

YES

archivepwd

if submitted file is password-protected archive

NO

Response

HTTP Status Codes

Please refer to Status Codes for more information.

Body

Example of successful scan request:

{
"data_id" : "ed3f536f7b384b11bd8285d4cce4d88f",
"rest_ip" : "api.metadefender.com/v2"
}

Example of failed scan request:

{
"528049058c14f610d48196016" : "Not Found"
}

Descriptions of response:

dataId

The identifier used to retrieve scan results

rest_ip

Requests for the scan progress using "data_id" should be made to this address instead of the original address. Once a scan is finished, future requests for this "data_id" can be made to the original address.

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": "/v2/rescan/b92f5193d01a48a1b6160b16610b6148",
"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/v2/rescan/b92f5193d01a48a1b6160b16610b6148 \
-H 'apikey: ${APIKEY}'