Feature Overview
The cloud virus detection feature adopts the async request method. You can use this API to detect viruses such as trojans and worms in COS files, and query the result through the appropriate API.
Billing Description
If the files are stored in COS STANDARD_IA storage class, calling the detection API will incur STANDARD_IA data retrieval fees as described in Data Retrieval Fees.
Detection is not supported for objects stored in the ARCHIVE or DEEP ARCHIVE storage classes. To detect these objects, you first need to restore them as instructed in POST Object restore.
Description
Supported file size: < 1 GB
Supported file formats: EXE, DLL, SCR, SYS, MSI, SWF, JAR, APPLETJAR, JS, VBS, HTML, BAT, WSF, PS1, HTM, MHT, HTA, CHM, LNK, DOC, DOCX, DOTX, DOCM, DOTM, XLS, XLSX, XLSM, XLSB, XLTM, XLTX, XLAM, PPT, PPTX, POTX, PPSX, PPTM, POTM, PPSM, XML, RTF, PDF, ELF, XML, MAC, VBE, 3DMAX, ISO, CPIO, RPM, XZ, DEB.
Supported compressed file formats: zip, 7z, rar4, rar5, inno, cab, autoit, nsis, gz, tar, iso, mime, chm, jar, dmg, apk.
Requests
Sample Request
POST /virus/detect HTTP/1.1Host: <BucketName-APPID>.ci.<Region>.myqcloud.comDate: <GMT Date>Authorization: <Auth String>Content-Length: <length>Content-Type: application/xml<body>
Note
Request Header
Request Body
This request requires the following request body:
<Request><Input><Object></Object><Url></Url></Input><Conf><DetectType>Virus</DetectType><Callback></Callback></Conf></Request>
The nodes are described as follows:
Node Name (Keyword) | Parent Node | Description | Local Disk Types | Required |
Request | - | Virus detection configuration. | Container | Required |
Request has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Local Disk Types | Required |
Input | Request | File to be detected. | Container | Required |
Conf | Request | Detection rule configuration. | Container | Required |
Input has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Local Disk Types | Required |
Object | Request.Input | The virus file name stored in the COS bucket, for example, the file virus.doc in the test directory, would be named as test/virus.doc. Note: You can only choose one option between Object and Url. | String | Required |
Url | Request.Input | The URL of the virus file, for example: http://examplebucket-1250000000.cos.ap-shanghai.myqcloud.com/virus.doc.Note: You can only choose one option between Object and Url. | String | Not required |
Conf has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Local Disk Types | Required |
DetectType | Request.Conf | Virus detection type, which is fixed at Virus currently. | String | Required |
Callback | Request.Conf | The detection result can be sent to your callback address in the form of a callback. Addresses starting with http:// or https:// are supported, such as http://www.callback.com. | String | Not required |
Response
Response Header
Response Body
The return of this response body is application/xml data. Below is an example containing all the node data:
<Response><JobsDetail><JobId></JobId><State></State><CreationTime></CreationTime></JobsDetail></Response>
The parameters are described as follows:
Node Name (Keyword) | Parent Node | Description | Local Disk Types |
Response | - | Specific virus detection response content. | Container |
Response has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Local Disk Types |
JobsDetail | Response | Virus detection job details | Container |
JobsDetail has the following sub-nodes:Node Name (Keyword) | Parent Node | Description | Local Disk Types |
JobId | Response.JobsDetail | Virus detection job ID. | String |
State | Response.JobsDetail | Virus detection job status. Valid values: Submitted, Success, Failed, Auditing. | String |
CreationTime | Response.JobsDetail | Virus detection job creation time. | String |
Error Codes
There are no specific error messages for this request operation. For common error messages, see Error Codes.
Examples
Requests
POST /virus/detect HTTP/1.1Authorization: q-sign-algorithm=sha1&q-ak=AKIDZfbOAo7cllgPvF9cXFrJD0a1ICvR<1>**&q-sign-time=1497530202;1497610202&q-key-time=1497530202;1497610202&q-header-list=&q-url-param-list=&q-signature=28e9a4986df11bed0255e97ff90500557e0e</1>**Host: examplebucket-1250000000.ci.ap-beijing.myqcloud.comContent-Length: 166Content-Type: application/xml<Request><Input><Object>a.doc</Object></Input><Conf><DetectType>Virus</DetectType><Callback>http://callback.com/</Callback></Conf></Request>
Response
HTTP/1.1 200 OKContent-Type: application/xmlContent-Length: 230Connection: keep-aliveDate: Thu, 15 Jun 2017 12:37:29 GMTServer: tencent-cix-ci-request-id: NTk0MjdmODlfMjQ4OGY3XzYzYzhf****<Response><JobsDetail><JobId>ssb1ca9fc8a3ed11ea834c525400863904</JobId><State>Submitted</State><CreationTime>2021-07-07T12:12:12+0800</CreationTime></JobsDetail></Response>