Restore frozen files using the OSS API

更新时间:
复制 MD 格式

If your files have been frozen by the file freezing feature in OSS Violation Detection V1.0, you can restore them using the OSS API. This topic describes how to restore them.

OSS billing

Restoring frozen files requires OSS API calls. For pricing information, see billing overview.

Step 1: Obtain the object name

To restore a file, you must first obtain its object name. This topic describes two ways to find it.

Method 1: Use a callback

If you configured a callback URL in the notification settings before you created the scan task, you can receive scan results through a callback. The result contains the object name. See the following example:

{
    "bucket": "oss-bucket",
    "freezed": false,
    "object": "2f6aa79ac1ff.jpeg",
    "region": "cn-shenzhen",
    "scanResult":
    {
        "code": 200,
        "dataId": "64C35B4244A95E3436025A57",
        "extras":
        {},
        "msg": "OK",
        "results":
        [
            {
                "extras":
                {},
                "label": "normal",
                "rate": 99.87,
                "scene": "terrorism",
                "suggestion": "pass"
            }
        ],
        "taskId": "img6g5D5eDXH1l7NNdX6DE1Ck-2ypIsw"
    },
    "stock": false
}

Method 2: Export from the console

  1. Log on to the Content Moderation console.

  2. In the left-side navigation pane, choose OSS Violation Detection V1.0 > Incremental Scan or OSS Violation Detection V1.0 > Full Scan.

  3. Find the task from which you want to export data. In the Actions column, click Scan Results. Then, set the search criteria and click Export.

    Note

    You can export up to 5,000 results for an incremental scan. For a full scan, if the total number of results is less than 500,000, all results are exported. If the total exceeds 500,000, only the results for violative and suspected items are exported.

Step 2: Restore frozen files

Select a restoration method based on the file freezing method that you configured for the scan task. See the following table for details.

File freezing method

Description

Actions

Modify permissions

If you set the file freezing method to modify permissions, OSS changes the permissions of violative objects in your bucket from public-read or public-read-write to private. Although anonymous users cannot read private objects, you can share them with partners by using signed URLs. For more information, see Signature Version 1.

Call the Object ACL API to restore the object's access permission to a non-private setting.

Move files

If you set the file freezing method to move files, OSS moves violative objects to a backup directory within the bucket and then deletes them from their original location. The backup directory is named aligreen_freeze_backup.

Use the copy file operation to restore the object to its original path.