MDES SDK Guides How to use the Mockup API

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

What is the Mockup API

The Mockup API provides a mechanism to test various output scenarios in any environment, against any product, for any method.

In order to use the Mockup API, MetaDefender Endpoint Security SDK must be configured correctly. Passing in the WAAPI_CONFIG_MOCKUP_MODE to wa_api_setup will cause the MDES SDK to run in Mockup mode. All calls to wa_api_invoke will only return successfully if they are defined in the mockup.json file (except for those mentioned in the Remarks section).

Every mockup.json file must contain the following core structure:

{
    "mockups": {
        ...
    }
}

The keys within the "mockups" object must contain the following structure:

"<V4 signature ID>": {
    "version": <string>,
    "methods": {
        ...
    }
}

The keys within the "methods" object must contain either of the following structures:

"<V4 method ID>": {
    "result": {
        "<V4 api result key>": <value to return>,
        ...
}

OR

"<V4 method ID>": {
    "error": {
        "code": <V4 error code>
    }
}

Below is an example of a complete mockup.json file:

*Remarks

  • When in "mocking" mode, all calls will fail with WAAPI_ERROR_INVALID_MOCKUP if the mockup.json format is incorrect or if the called method is not defined in the mockup.
  • The only methods that will not (and cannot) be mocked are the following: GetLicenseInfo, UpdateLicenseInfo, GetDeviceIdentity, GetComponents and GetProductInfo
  • Any result key may be defined for the output, but the following keys will always be defined for every call: "method", "code", "timing", "timestamp". If "code" is defined then the api will return that code in place of any other.