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 more information about how to upload a file, see 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.
Unique file identifier
All file detection operations include the HashKey parameter, which specifies the unique identifier of the file to be detected and is used to query detection results.
Calculate the HashKey before you call this operation. Only the MD5 or SHA-256 hash of the complete file content is supported.
To calculate the MD5 or SHA-256 hash of the file content, perform the following 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 the Python hex function. Make sure the final string is a combination of digits and lowercase letters. The MD5 hash is 32 characters long, and the SHA-256 hash is 64 characters long.
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 the file to be detected. Valid values:
|
0 |
| HashKey |
string |
No |
The unique identifier of the file. This parameter is required and must be the MD5 or SHA-256 hash 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. You can obtain this parameter by calling the CreateFileDetectUploadUrl operation. Note: If Type is set to 0 and DownloadUrl is not provided, this parameter is required and must be obtained by calling 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 if Decompress is set to true. |
1 |
| DecompressMaxFileCount |
integer |
No |
The maximum number of files to decompress. Maximum value: 1000. This parameter is required if 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 this ID 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.