Cross-domain API

Although cookie and client certificate integration methods work well under most scenarios. However, both methods heavily depend on browser applications and sometimes require end-users interaction which could introduce usability issues. My OPSWAT Central Management now offers a cross-domain API for you to integrate with your solution. This method leverages JSONP technology to overcome the cross-domain restrictions imposed by browsers' same-origin policy that limits access to resources retrieved from origins other than the one the page was served by.

The cross-domain API can be enabled on My OPSWAT Central Management console as the screenshot below.

Once the cross-domain API setting is enabled, MetaDefender Endpoint tries to open a cross-domain API at the configured port on an endpoint. Please make sure that the configured port is valid and not used by any existing applications running on the same endpoint.

Whenever MetaDefender Endpoint is uninstalled/stopped, the cross-domain API will be closed and the configured port will be released on the endpoint.

API Description

Request

Description
URL pathhttps://eapi.opswatgears.com:[configuredport]/opswat/devinfo
URL path (API V3)https://eapi.opswatgears.com:[configuredport]/opswat/3/devinfo
MethodGET

In which:

  • configured port: the port you configured for the cross-domain API settings on My OPSWAT Central Management account which the endpoint is reporting to.
  • eapi.opswatgears.com is resolved as 127.0.0.1. If endpoints are running proxy, you need to add exception on the proxy settings to ignore queries to eapi.opswatgears.com.

For example:

Copy

Success response

The response json will be padded by the value of "callback" parameter

Copy

Error response

Copy
KeyDataTypeDefinition
codenumber

Status code. Values could be:

  • 0: success
  • -30: Timeout
  • -31: API not found
  • -32: Verification failed
  • -41: Failed to get hardware id
descriptionstringresult details
infoobjectdevice information
info.hwidstringdevice id of the device. This information is used to query device information from the cloud.

Sample code V1 (Don't use JWT token to verify the response data - Less secure)

Client sample (you can download from here)

Copy

Note: you can find jquery-3.1.1.min.js and opswat.jsonp.js in the sample package.

Sample code V2: (Using JWT token to verify the response data - more secure)

Client sample (you can download from client_sample_code_v2.zip)

Copy

Note: you can find jquery-3.1.1.min.js, jsrsasign-all-min.js and opswat.jsonp.js in the client_sample_code_v2.zip.

Sample code V3: (Using JWT token to verify the response data and support Cross-Origin Resource Sharing - CORS)

Client sample (you can download from client_sample_code_v3.zip)

None
Copy

Note: you can find jquery-3.1.1.min.js, jsrsasign-all-min.js and opswat.jsonp.js in the client_sample_code_v3.zip** **

Success response:

Copy

Error response:

Copy

Support chart

As of November 10th, 2016, Cross-Domain API solution is only supported on persistent agents.

Persistent agentOn-demand agent
WindowsYesYes
macOSYesYes
LinuxYes
AndroidNo
iOSNo

The below MetaDefender Endpoint versions support https protocol for the cross-domain API.

  • Windows persistent agent version: 7.6.121.0+
  • macOS persistent agent version: 10.4.147.0+
Type to search, ESC to discard
Type to search, ESC to discard
Type to search, ESC to discard