Pushes a file to the cloud for detection.
Operation description
Pushes a file to the cloud for detection.
File upload methods
Two file upload methods are supported: pre-upload and download URL.
If you use the pre-upload method, confirm that the file is uploaded before you invoke this operation. For information about how to upload a file, refer to the CreateFileDetectUploadUrl operation.
If you use the download URL method, pass in a download URL that supports public network access by using the DownloadUrl parameter.
File unique identifier
All file detection operations include the HashKey parameter, which represents the unique identifier of the file being detected and is used to query detection results.
Calculate the HashKey before calling the operation. Only the MD5 or SHA-256 of the complete file content is supported.
To calculate the MD5 or SHA-256 value of the file content, follow these two steps:
-
Use the MD5 or SHA-256 algorithm to encrypt the data and generate a 128-bit or 256-bit hash value. Available libraries include Java MessageDigest and Python hashlib.
-
Encode the generated hash value as a hexadecimal string. Available libraries include Java Codec and Python hex function. Make sure the final string is a combination of digits and lowercase letters. The MD5 string is 32 characters, and the SHA-256 string is 64 characters.
Note: The push and query operations for a single detection must use the same HashKey. Otherwise, the detection cannot be correctly pushed and the results cannot be queried.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
yundun-sas:CreateFileDetect |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| SourceIp |
string |
No |
The IP address of the access source. |
115.213.XX.XX |
| Type |
integer |
Yes |
The type of file to detect. Valid values:
|
0 |
| HashKey |
string |
No |
The unique identifier of the file. This parameter is required and must be the MD5 or SHA-256 of the file. |
0a212417e65c26ff133cfff28f6c**** |
| OssKey |
string |
No |
The storage key of the file in the OSS bucket. If you push the file for detection by using DownloadUrl, this parameter is optional. This parameter is obtained from the CreateFileDetectUploadUrl operation. |
1/2022/06/23/15/41/16559701077444693a0c6-33b2-4cc2-a99f-9f38b8b8**** |
| DownloadUrl |
string |
No |
The download URL of the file. You can pass in a file download URL (public URL) to directly trigger file detection without uploading the file in advance. |
https://xxxxxxxx.oss-cn-hangzhou-1.aliyuncs.com/xxxxx/xxxxxxxxxxxxxx?Expires=1671448125&OSSAccessKeyId=xxx |
| Decompress |
boolean |
No |
Specifies whether to identify and decompress compressed files. Valid values:
|
false |
| DecompressMaxLayer |
integer |
No |
The maximum number of decompression layers when compressed files are nested within a compressed package. Maximum value: 5. This parameter is required when Decompress is set to true. |
1 |
| DecompressMaxFileCount |
integer |
No |
The maximum number of files to decompress. Maximum value: 1000. This parameter is required when Decompress is set to true. |
100 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
|||
| RequestId |
string |
The request ID, which is a unique identifier generated by Alibaba Cloud for the request. You can use it to troubleshoot issues. |
7E0618A9-D5EF-4220-9471-C42B5E92719F |
| HashKey |
string |
The file identifier. |
0a212417e65c26ff133cfff28f6c**** |
Examples
Success response
JSON format
{
"RequestId": "7E0618A9-D5EF-4220-9471-C42B5E92719F",
"HashKey": "0a212417e65c26ff133cfff28f6c****"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | RequestTooFrequently | Request too frequently, please try again later | |
| 400 | GetFileError | Get file error, please check input params and file size, and make sure upload file success. | |
| 400 | InvalidDownloadUrl | Invalid file download URL. | |
| 400 | FileSizeOverLimit | File size over limit. | |
| 500 | ServerError | ServerError | |
| 500 | SystemBusy | System busy, please try again later. | |
| 403 | NoPermission | caller has no permission | You are not authorized to do this operation. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.