MDES SDK Guides How to use the Asynchronous API

Hover over each of the signs to view the pop-up details.

What is the Async API?

The Async API provides a mechanism to run asynchronous wa_api_invoke calls.

In order to use the Async API, MetaDefender Endpoint Security SDK must be configured correctly. Passing in the WAAPI_CONFIG_ASYNC_API_MODE to wa_api_setup configures whether and how the MDES SDK makes asynchronous calls for that session. Depending on the configuration, calls to wa_api_invoke can be executed such that they will not wait for the invoke call to finish. Instead the calls will return immediately with a job identifier to allow tracking the call.

Performing an Async Invoke

Every wa_api_invoke call can be made asynchronously. Here is an example of calling DetectProducts asynchronously:

{
    "input" : {
        "method" : 0,
        "async_job" : true
    }
}

All async calls will return the following json from wa_api_invoke:

{
    "result" : {
        "method" : number,
        "code" : number,
        "timing" : number,
        "timestamp" : string,
        "async_job_id" : string
    }
}

Retrieving Async Invoke Results

A separate wa_api_invoke method, QueryAsyncResults, allows you to retrieve all asynchronous calls that have completed at the time of its calling. This method can be polled for async results until there are no more results to collect, which can be identified by the return code from the call.

*Remarks

  • Some calls, such as a full scan for an Antimalware product, are async by nature, but can still be made through the Async API. These calls will not become synchronous by using this API mode, i.e. we will not wait for the full scan to finish before returning results.