All Products
Search
Document Center

Security Center:CreateFileDetectUploadUrl

更新時間:Nov 25, 2024

Queries the parameters that are required to upload a file for detection.

Operation description

You can call this operation to query the parameters that are required to upload a file for detection. If the value of the response parameter FileExist is true, the file that you want to upload for detection already exists in the cloud. In this case, you can directly push the file for detection. If the value of the response parameter FileExist is false, you must use the form upload method to upload the file to the specified Object Storage Service (OSS) bucket based on the response parameters of this operation.

The form upload method is provided by OSS. For more information, see Form upload.

The HashKey parameter is included in all API operations that are related to the file detection feature. The parameter specifies the unique identifier of a file. Only MD5 hash values are supported. Before you call this operation, calculate the MD5 hash value of the file.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
yundun-sas:CreateFileDetectUploadUrlcreate
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
HashKeyListarrayNo

The identifiers of files. Only MD5 hash values are supported.

Note You must specify at least one of the HashKeyList and HashKeyContextList parameters.
stringNo

The identifier of the file. Only MD5 hash values are supported.

0a212417e65c26ff133cfff28f6c****
TypeintegerYes

The type of the file. Valid values:

  • 0: unknown file
  • 1: binary file
  • 2: webshell file
  • 4: script file
Note If you do not know the type of the file, set this parameter to 0.
0
HashKeyContextListarray<object>No

The hash values of files.

Note You must specify at least one of the HashKeyList and HashKeyContextList parameters.
objectNo
HashKeystringNo

The hash value of the file.

30319dd5cee8f894766e479cac170da0
FileSizeintegerNo

The size of the file. Unit: bytes.

2698557

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request, which is used to locate and troubleshoot issues.

09969D2C-4FAD-429E-BFBF-9A60DEF8BF6F
UploadUrlListarray<object>

An array consisting of the parameters that are required to upload a file.

UploadUrListobject
PublicUrlstring

The public endpoint of the URL to which the file is uploaded.

http://example.com
InternalUrlstring

The internal endpoint of the URL to which the file is uploaded.

http://example.com
Expirestring

The timestamp when the values of the parameters expire. Unit: milliseconds.

1658562101370
Contextobject

The signature information.

AccessIdstring

The AccessKey ID that is used to access the OSS bucket.

LTAI4G1mgPbjvGQuiV1X****
Policystring

The policy that poses limits on file upload. For example, the policy can limit the size of the file.

eyJleHBpcmF0aW9uIjoiMjAyMi0wNy0yM1QxMDo1ODoxMC43NTNaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMjA5NzE1MjBdLFsiZXEiLCIka2V5IiwiMS8yMDIyLzA2LzIzLzE4LzU4LzE2NTU5ODE4OTA3NTM4NTc2MjFkNS1kN2E1LTQ5YzAtOGJjZi0yMTMyY2JiYTdmYzMi****
Signaturestring

The signature that is used to upload the file.

wDhPgVdnY/bkKFYcYFl+4crl****
OssKeystring

The key of the file that is used after the file is uploaded to the OSS bucket.

1/2022/06/23/15/41/16559701077444693a0c6-33b2-4cc2-a99f-9f38b8b8****
FileExistboolean

Indicates whether the file exists in the cloud. Valid values:

  • true: The file exists in the cloud. You do not need to upload the file.
  • false: The file does not exist in the cloud. You must upload the file.
false
HashKeystring

The identifier of the file.

0a212417e65c26ff133cfff28f6c****
Codestring

The status code returned. The status code 200 indicates that the request was successful. Other status codes indicate that the request failed. You can identify the cause of the failure based on the status code.

200
Messagestring

The error message returned.

successful

Examples

Sample success responses

JSONformat

{
  "RequestId": "09969D2C-4FAD-429E-BFBF-9A60DEF8BF6F",
  "UploadUrlList": [
    {
      "PublicUrl": "http://example.com",
      "InternalUrl": "http://example.com",
      "Expire": "1658562101370",
      "Context": {
        "AccessId": "LTAI4G1mgPbjvGQuiV1X****",
        "Policy": "eyJleHBpcmF0aW9uIjoiMjAyMi0wNy0yM1QxMDo1ODoxMC43NTNaIiwiY29uZGl0aW9ucyI6W1siY29udGVudC1sZW5ndGgtcmFuZ2UiLDAsMjA5NzE1MjBdLFsiZXEiLCIka2V5IiwiMS8yMDIyLzA2LzIzLzE4LzU4LzE2NTU5ODE4OTA3NTM4NTc2MjFkNS1kN2E1LTQ5YzAtOGJjZi0yMTMyY2JiYTdmYzMi****",
        "Signature": "wDhPgVdnY/bkKFYcYFl+4crl****",
        "OssKey": "1/2022/06/23/15/41/16559701077444693a0c6-33b2-4cc2-a99f-9f38b8b8****"
      },
      "FileExist": false,
      "HashKey": "0a212417e65c26ff133cfff28f6c****",
      "Code": "200",
      "Message": "successful"
    }
  ]
}

Error codes

HTTP status codeError codeError messageDescription
400RequestTooFrequentlyRequest too frequently, please try again later-
400InvalidApiDetectTypeUnsupported Api Detect Type.The file type is not supported.
403NoPermissioncaller has no permissionYou are not authorized to do this operation.
500ServerErrorServerError-
500SystemBusySystem busy, please try again later.-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-06-19API Description Update. The Error code has changedView Change Details
2022-08-22The Error code has changed. The request parameters of the API has changed. The response structure of the API has changedView Change Details
2022-08-22The Error code has changed. The request parameters of the API has changed. The response structure of the API has changedView Change Details