Updated on 2026-02-27 GMT+08:00

List Synchronization Tasks

Function

This API is used to query all synchronization tasks under a user account.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    oms:synctask:list

    List

    synctask *

    -

    -

    -

URI

GET /v2/{project_id}/sync-tasks

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

The project ID.

Minimum: 1

Maximum: 1024

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

limit

No

Integer

The maximum number of synchronization tasks displayed on one page. The default value is 10.

A maximum of 100 records can be returned.

Minimum: 1

Maximum: 100

Default: 10

offset

No

Integer

The start serial number of migration task groups. The default value is 0.

The value must be greater than or equal to 0. If offset is set to 0, the query starts from the first record.

Minimum: 0

Maximum: 10000

Default: 0

status

No

String

The synchronization task status. If this parameter is not specified, tasks in all statuses are queried.

SYNCHRONIZING

STOPPED

Minimum: 0

Maximum: 255

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

The token used for IAM authentication.

Minimum: 1

Maximum: 16384

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

tasks

Array of SyncTaskInfo objects

The details of queried synchronization tasks.

Array Length: 0 - 100

count

Long

The total number of synchronization tasks that meet the query criteria.

Minimum: 0

Maximum: 9223372036854775807

Table 5 SyncTaskInfo

Parameter

Type

Description

sync_task_id

String

The synchronization task ID.

Minimum: 0

Maximum: 255

src_cloud_type

String

The source cloud service provider.The value can be AWS, Azure, Aliyun, Tencent, HuaweiCloud, QingCloud, KingsoftCloud, Baidu, Qiniu, or UCloud. The default value is Aliyun.

Enumeration values:

  • AWS

  • Azure

  • Aliyun

  • Tencent

  • HuaweiCloud

  • QingCloud

  • KingsoftCloud

  • Baidu

  • Qiniu

  • UCloud

src_region

String

The region where the source bucket is located.

Minimum: 0

Maximum: 100

src_bucket

String

Source bucket.

Minimum: 0

Maximum: 1024

create_time

Long

The time (Unix timestamp, in milliseconds) when the synchronization task was created.

Minimum: 0

Maximum: 9223372036854775807

last_start_time

Long

The last time (Unix timestamp, in milliseconds) when the synchronization task was started.

Minimum: 0

Maximum: 9223372036854775807

dst_bucket

String

The destination bucket.

Minimum: 0

Maximum: 1024

dst_region

String

The region where the destination bucket is located.

Minimum: 0

Maximum: 100

description

String

The task description, which cannot exceed 255 characters. The following special characters are not allowed: <>()"'&

Minimum: 0

Maximum: 255

status

String

The synchronization task status. The value can be:

SYNCHRONIZING: being synchronizing

STOPPED: already stopped

Enumeration values:

  • SYNCHRONIZING

  • STOPPED

enable_metadata_migration

Boolean

Whether metadata migration is enabled. This function is disabled by default. Even if this function is disabled, the Content-Type metadata will still be migrated to ensure a successful migration.

enable_restore

Boolean

Whether automatic restoration of archived data is enabled. This function is disabled by default. If this function is enabled, archived data is automatically restored and migrated.

app_id

String

Tencent Cloud app ID. This parameter is returned if cloud_type is Tencent.

Minimum: 0

Maximum: 255

source_cdn

SourceCdnResp object

Whether migration from CDN is enabled. If it is enabled, the source objects to be migrated are obtained from the specified CDN domain name during migration. If this parameter is included, migration from CDN is supported. Otherwise, it is not supported.

object_overwrite_mode

String

How a source object handles its paired destination object, either overwriting the object or skipping the migration. The default value is SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE.NO_OVERWRITE indicates the system never allows overwriting. The system always skips source objects and keeps their paired destination objects.SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE: The system allows overwriting based on the results of size or modification time checks. This is the default value. If a source object has the same name as the paired destination object, the system compares the sizes and last modification time of the source and destination objects to determine whether to overwrite the destination object. The encryption status of the source and destination objects must be the same. If the source object has a different size or was last modified more recently than its paired destination object, the destination object will be overwritten.CRC64_COMPARISON_OVERWRITE: The system allows overwriting if the source and destination objects have different CRC64 checksums. This option is only available for migration within Huawei Cloud or from Alibaba Cloud or Tencent Cloud. If a source object has a CRC64 checksum different from its paired destination object, the destination object will be overwritten. The encryption status of the source and destination objects must be the same. If there are no CRC64 checksums in the metadata, the SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE value is used.FULL_OVERWRITE indicates the system always allows overwriting. The system always allows source objects to overwrite their paired destination objects.

Enumeration values:

  • NO_OVERWRITE

  • SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE

  • CRC64_COMPARISON_OVERWRITE

  • FULL_OVERWRITE

dst_storage_policy

String

The destination storage class. This parameter is required only when the destination is Huawei Cloud OBS. The default value is STANDARD.

STANDARD: Huawei Cloud OBS Standard storage

IA: Huawei Cloud OBS Infrequent Access storage

ARCHIVE: Huawei Cloud OBS Archive storage

DEEP_ARCHIVE: Huawei Cloud OBS Deep Archive storage

SRC_STORAGE_MAPPING: The source storage class is retained and mapped to Huawei Cloud OBS storage class.

Default: STANDARD

Minimum: 0

Maximum: 128

Enumeration values:

  • STANDARD

  • IA

  • ARCHIVE

  • DEEP_ARCHIVE

  • SRC_STORAGE_MAPPING

consistency_check

String

The method for checking whether objects are consistent after migration. The encryption status of the source and destination objects must be the same. The check method and results will be recorded in the object list. The default value is size_last_modified.size_last_modified: The default value. The system checks object consistency with object size and last modification time. If the source and destination objects have the same size and the destination's last modification time is not earlier than the source's, the system considers the source object has been already migrated successfully.crc64: This option is only available for migration on Huawei Cloud or from Alibaba Cloud or Tencent Cloud. After migration, if a source object and its paired destination object have CRC64 checksums in the metadata, the checksums are checked. Otherwise, their sizes and last modification times are checked.no_check: This option is only available for migration of HTTP/HTTPS data. This option takes effect for source objects whose sizes cannot be obtained from the Content-Length field in the standard HTTP protocol. In this case, the migration is considered successful once the data is downloaded successfully, without requiring additional data check. If the size of a source object can be obtained from the Content-Length field in the standard HTTP protocol, its size and last modification time will be checked.

Enumeration values:

  • size_last_modified

  • crc64

  • no_check

Table 6 SourceCdnResp

Parameter

Type

Description

domain

String

The domain name used to obtain objects to be migrated.

Minimum: 0

Maximum: 1024

protocol

String

The protocol type. HTTP and HTTPS are supported.

Enumeration values:

  • http

  • https

authentication_type

String

The authentication type. The value can be:

NONE: public access without authentication type

QINIU_PRIVATE_AUTHENTICATION: Qiniu private URL signature

ALIYUN_OSS_A: Alibaba Cloud URL signature, simple and universal

ALIYUN_OSS_B: Alibaba Cloud header signature, used for API calling

ALIYUN_OSS_C: Alibaba Cloud STS temporary security token, the most secure

KSYUN_PRIVATE_AUTHENTICATION: Kingsoft Cloud private URL signature

AZURE_SAS_TOKEN: Microsoft Azure shared access signature, flexible and secure

TENCENT_COS_A: Tencent Cloud multi-signature scenarios (not recommended)

TENCENT_COS_B: Tencent Cloud single-signature scenarios, the most secure

TENCENT_COS_C: Tencent Cloud header signature, used for API calling

TENCENT_COS_D: Tencent Cloud header signature, used for API calling

Enumeration values:

  • NONE

  • QINIU_PRIVATE_AUTHENTICATION

  • ALIYUN_OSS_A

  • ALIYUN_OSS_B

  • ALIYUN_OSS_C

  • KSYUN_PRIVATE_AUTHENTICATION

  • AZURE_SAS_TOKEN

  • TENCENT_COS_A

  • TENCENT_COS_B

  • TENCENT_COS_C

  • TENCENT_COS_D

Status code: 400

Table 7 Response body parameters

Parameter

Type

Description

error_msg

String

Error message.

error_code

String

Error code.

Example Requests

This example queries five synchronization tasks in the project 2c0689c860ad4728a497c91ec0844383.

GET https://{endpoint}/v2/2c0689c860ad4728a497c91ec0844383/sync-tasks?offset=0&limit=5&status=SYNCHRONIZING

Example Responses

Status code: 200

OK

{
  "tasks" : [ {
    "sync_task_id" : "d18befdd-eb82-41f3-8019-bbb593d74a3e",
    "src_cloud_type" : "HuaweiCloud",
    "src_region" : "cn-north-7",
    "src_bucket" : "oms-sdk-test-src",
    "create_time" : 1700639560751,
    "last_start_time" : 1700639560751,
    "dst_bucket" : "oms-sdk-test-dst",
    "dst_region" : "cn-north-7",
    "description" : "sync task test",
    "status" : "SYNCHRONIZING",
    "enable_metadata_migration" : false,
    "enable_restore" : false,
    "app_id" : null,
    "source_cdn" : null,
    "object_overwrite_mode" : "SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE",
    "dst_storage_policy" : null,
    "consistency_check" : "size_last_modified"
  } ],
  "count" : 1
}

SDK Sample Code

The SDK sample code is as follows.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package com.huaweicloud.sdk.test;

import com.huaweicloud.sdk.core.auth.ICredential;
import com.huaweicloud.sdk.core.auth.BasicCredentials;
import com.huaweicloud.sdk.core.exception.ConnectionException;
import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
import com.huaweicloud.sdk.core.exception.ServiceResponseException;
import com.huaweicloud.sdk.oms.v2.region.OmsRegion;
import com.huaweicloud.sdk.oms.v2.*;
import com.huaweicloud.sdk.oms.v2.model.*;


public class ListSyncTasksSolution {

    public static void main(String[] args) {
        // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
        // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
        String ak = System.getenv("CLOUD_SDK_AK");
        String sk = System.getenv("CLOUD_SDK_SK");
        String projectId = "{project_id}";

        ICredential auth = new BasicCredentials()
                .withProjectId(projectId)
                .withAk(ak)
                .withSk(sk);

        OmsClient client = OmsClient.newBuilder()
                .withCredential(auth)
                .withRegion(OmsRegion.valueOf("<YOUR REGION>"))
                .build();
        ListSyncTasksRequest request = new ListSyncTasksRequest();
        try {
            ListSyncTasksResponse response = client.listSyncTasks(request);
            System.out.println(response.toString());
        } catch (ConnectionException e) {
            e.printStackTrace();
        } catch (RequestTimeoutException e) {
            e.printStackTrace();
        } catch (ServiceResponseException e) {
            e.printStackTrace();
            System.out.println(e.getHttpStatusCode());
            System.out.println(e.getRequestId());
            System.out.println(e.getErrorCode());
            System.out.println(e.getErrorMsg());
        }
    }
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# coding: utf-8

import os
from huaweicloudsdkcore.auth.credentials import BasicCredentials
from huaweicloudsdkoms.v2.region.oms_region import OmsRegion
from huaweicloudsdkcore.exceptions import exceptions
from huaweicloudsdkoms.v2 import *

if __name__ == "__main__":
    # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak = os.environ["CLOUD_SDK_AK"]
    sk = os.environ["CLOUD_SDK_SK"]
    projectId = "{project_id}"

    credentials = BasicCredentials(ak, sk, projectId)

    client = OmsClient.new_builder() \
        .with_credentials(credentials) \
        .with_region(OmsRegion.value_of("<YOUR REGION>")) \
        .build()

    try:
        request = ListSyncTasksRequest()
        response = client.list_sync_tasks(request)
        print(response)
    except exceptions.ClientRequestException as e:
        print(e.status_code)
        print(e.request_id)
        print(e.error_code)
        print(e.error_msg)
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main

import (
	"fmt"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/basic"
    oms "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/oms/v2"
	"github.com/huaweicloud/huaweicloud-sdk-go-v3/services/oms/v2/model"
    region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/oms/v2/region"
)

func main() {
    // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
    // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
    ak := os.Getenv("CLOUD_SDK_AK")
    sk := os.Getenv("CLOUD_SDK_SK")
    projectId := "{project_id}"

    auth := basic.NewCredentialsBuilder().
        WithAk(ak).
        WithSk(sk).
        WithProjectId(projectId).
        Build()

    client := oms.NewOmsClient(
        oms.OmsClientBuilder().
            WithRegion(region.ValueOf("<YOUR REGION>")).
            WithCredential(auth).
            Build())

    request := &model.ListSyncTasksRequest{}
	response, err := client.ListSyncTasks(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.

Status Codes

Status Code

Description

200

OK

400

Bad Request

Error Codes

See Error Codes.