ScanThis API
We provide a simple HTTP POST & JSON string based API for you to use. In fact we use it ourselves to provide the AJAX (AJAJ?) features of this site!
The API works by accepting an action string and extra values. We accept the following actions:
Upload
This action allows you to upload a file to our server for scanning. The return value will either be a message of success containing a unique ID string you can use to retrieve the scan results, or an error string describing what went wrong.
POST Data
- action: "upload"
- data: Binary file to scan.
- clientid: Name of your client. Max 32 chars. [Not Required]
- clientversion: Version of your client. Max 32 chars. [Not Required]
Successful Return
- success: TRUE
- id: Unique 32 character id string.
Error Return
- error: String describing the error in English.
Download
This action allows you to provide a URL for us to download to our servers for scanning. The return value will either be a message of success containing a unique ID string you can use to retrieve the scan results, or an error string describing what went wrong.
POST Data
- action: "download"
- url: URL String
- clientid: Name of your client. Max 32 chars. [Not Required]
- clientversion: Version of your client. Max 32 chars. [Not Required]
Successful Return
- success: TRUE
- id: Unique 32 character id string.
Error Return
- error: String describing the error in English.
Check
This action allows you to check the status of a scan. You may need to poll this action a few times until you get the scan results back. We ask that you wait approximately 15 seconds after posting before your first poll, it would be reasonable to poll on 5 seconds after that.
POST Data
- action: "check"
- id: Unique 32 character string.
- clientid: Name of your client. Max 32 chars. [Not Required]
- clientversion: Version of your client. Max 32 chars. [Not Required]
Successful Return
- id: Your unique 32 character id string.
- scanned: TRUE/FALSE -- Has the scan been completed yet?
- infected: TRUE/FALSE -- Is the file infected? This will only be set if scanned is TRUE.
- virus: Name of the virus as identified by ClamAV. This will only be set is scanned and infected are set to TRUE.
- id: Unique 32 character id string.
Error Return
- error: String describing the error in English.
