How to Scan A File for Viruses in Salesforce Apex

SwagScanApi api = new SwagScanApi();
SwagClient client = api.getClient();
// Configure API key authorization: Apikey
ApiKeyAuth Apikey = (ApiKeyAuth) client.getAuthentication('Apikey');
Apikey.setApiKey('YOUR API KEY');
Map<String, Object> params = new Map<String, Object>{
'inputFile' => Blob.valueOf('Sample text file\nContents'),
'allowExecutables' => true,
'allowInvalidFiles' => true,
'allowScripts' => true,
'allowPasswordProtectedFiles' => true,
'allowMacros' => true,
'restrictFileTypes' => 'restrictFileTypes_example'
};
try {
// cross your fingers
SwagVirusScanAdvancedResult result = api.scanFileAdvanced(params);
System.debug(result);
} catch (Swagger.ApiException e) {
// ...handle your exceptions
}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Cloudmersive

Cloudmersive

437 Followers

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.