8. MetaDefender Core Developer Guide

How to Interact with MetaDefender Core using REST

Beginning with MetaDefender Core 4.x, OPSWAT recommends using the JSON-based REST API.
The available methods are documented below.

File scan process

  1. Upload a file to scan (POST to /file resource), then receive data_id from response: (Scan File)
    Note: The performance depends on:

    • number of nodes (scaling)

    • number of engines per node

    • type of file to be scanned

    • Metadefender Core and nodes' hardware

  2. Fetch the result with previously received data_id (GET from /file/{data_id resource) until scan result belonging to data_id doesn't reach the 100 percent progress_percentage: ( Fetch processing result)
    Note: Too many data_id requests can reduce performance. It is enough to just check every few hundred milliseconds.

  3. Retrieve the scan results anytime after the scan is completed with hash for files (md5, sha1, sha256). (The hash can be found in the scan results) ( Fetch processing result)

OPSWAT provides some sample codes on GitHub to make it easier to understand how the MetaDefender REST API works.