Updated on 2025-09-08 GMT+08:00

Querying a Synchronization Task

Function

This API is used to query details about a synchronization task with a specified ID.

Calling Method

For details, see Calling APIs.

URI

GET /v2/{project_id}/sync-tasks/{sync_task_id}

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

The project ID.

Minimum length: 1 character

Maximum length: 1,024 characters

sync_task_id

Yes

String

The synchronization task ID.

Minimum length: 0 characters

Maximum length: 255 characters

Table 2 Query parameters

Parameter

Mandatory

Type

Description

query_time

Yes

String

The time (in milliseconds) when the synchronization task details are queried. The statistics of the current month are returned based on the value of this parameter.

Minimum length: 1 character

Maximum length: 1,024 characters

Request

Table 3 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

The token used for IAM authentication.

Minimum length: 1 character

Maximum length: 16,384 characters

Response

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

sync_task_id

String

The synchronization task ID.

Minimum length: 0 characters

Maximum length: 255 characters

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.

The value can be:

  • AWS

  • Azure

  • Aliyun

  • Tencent

  • HuaweiCloud

  • QingCloud

  • KingsoftCloud

  • Baidu

  • Qiniu

  • UCloud

src_region

String

The region where the source bucket is located.

Minimum length: 0 characters

Maximum length: 100 characters

src_bucket

String

The name of the source bucket.

Minimum length: 0 characters

Maximum length: 1,024 characters

create_time

Long

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

Minimum value: 0

Maximum value: 9223372036854775807

last_start_time

Long

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

Minimum value: 0

Maximum value: 9223372036854775807

dst_bucket

String

The name of the destination bucket.

Minimum length: 0 characters

Maximum length: 1,024 characters

dst_region

String

The region where the destination bucket is located.

Minimum length: 0 characters

Maximum length: 100 characters

description

String

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

Minimum length: 0 characters

Maximum length: 255 characters

status

String

The synchronization task status.

SYNCHRONIZING: a synchronizing status

STOPPED: a stopped status

The value can be:

  • SYNCHRONIZING

  • STOPPED

enable_kms

Boolean

Indicates whether KMS encryption is enabled. This function is disabled by default.

enable_metadata_migration

Boolean

Indicates whether metadata migration is enabled. The default value is false. Even if this function is disabled, the Content-Type metadata will still be migrated to ensure a successful migration.

enable_restore

Boolean

Indicates whether automatic restoration of archived data is enabled. The default value is No. If this function is enabled, archived data is automatically restored and migrated.

app_id

String

This parameter is mandatory when cloud_type is Tencent.

Minimum length: 0 characters

Maximum length: 255 characters

monthly_acceptance_request

Long

The number of objects requested for synchronization in the current month.

Minimum value: 0

Maximum value: 9223372036854775807

monthly_success_object

Long

The number of objects that were successfully synchronized in the current month.

Minimum value: 0

Maximum value: 9223372036854775807

monthly_failure_object

Long

The number of objects that failed to be synchronized in the current month.

Minimum value: 0

Maximum value: 9223372036854775807

monthly_skip_object

Long

The number of objects that were ignored in the current month.

Minimum value: 0

Maximum value: 9223372036854775807

monthly_size

Long

The total size of synchronized objects in the current month, in bytes.

Minimum value: 0

Maximum value: 9223372036854775807

object_overwrite_mode

String

Indicates whether a source object is allowed to overwrite its paired destination object. 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 indicates the system allows overwriting based on the results of size or modification time checks. It is the default setting. If a source object is not as large as or was last modified more recently than its paired destination object, the source object will overwrite the destination object. Otherwise, the source object will be skipped. CRC64_COMPARISON_OVERWRITE indicates 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 the paired destination object, the source object will overwrite the destination object. Otherwise, the source object will be skipped. If either of them lacks a CRC64 checksum in the metadata, their sizes and last modification times are checked. FULL_OVERWRITE indicates the system always allows overwriting. The system always allows source objects to overwrite their paired destination objects.

The value can be:

  • 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: converts the source storage class into an OBS storage class based on the predefined rules.

Default value: STANDARD

Minimum length: 0 characters

Maximum length: 128 characters

The value can be:

  • STANDARD

  • IA

  • ARCHIVE

  • DEEP_ARCHIVE

  • SRC_STORAGE_MAPPING

consistency_check

String

The consistency check method, which is used to check whether objects are consistent before and after migration. The selected check method and results will be recorded in the object list. The default value is size_last_modified. size_last_modified is the default setting. The system checks object consistency with object size and last modification time. If a source object is as large as but was last modified earlier than its paired destination object, the system considers the source object has been already migrated successfully. crc64 is only available for migration within Huawei Cloud or from Alibaba Cloud or Tencent Cloud. 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 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. These source objects are marked as successfully migrated. 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.

The value can be:

  • size_last_modified

  • crc64

  • no_check

Status code: 404

Table 5 Response body parameters

Parameter

Type

Description

error_msg

String

The error message.

error_code

String

The error code.

Example Request

This example queries the details of task 0d146099-8cf4-437d-b6ef-88e043771c8b in project 2c0689c860ad4728a497c91ec0844383.

GET https://{endpoint}/v2/2c0689c860ad4728a497c91ec0844383/sync-tasks/0d146099-8cf4-437d-b6ef-88e043771c8b

Example Response

Status code: 200

OK

{
  "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_kms" : false,
  "enable_metadata_migration" : false,
  "enable_restore" : false,
  "app_id" : null,
  "monthly_acceptance_request" : 11,
  "monthly_success_object" : 0,
  "monthly_failure_object" : 11,
  "monthly_skip_object" : 0,
  "monthly_size" : 0,
  "object_overwrite_mode" : "SIZE_LAST_MODIFIED_COMPARISON_OVERWRITE",
  "dst_storage_policy" : null,
  "consistency_check" : "size_last_modified"
}

SDK Sample Code

The 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
48
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 ShowSyncTaskSolution {

    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();
        ShowSyncTaskRequest request = new ShowSyncTaskRequest();
        request.withSyncTaskId("{sync_task_id}");
        try {
            ShowSyncTaskResponse response = client.showSyncTask(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
32
# 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 = ShowSyncTaskRequest()
        request.sync_task_id = "{sync_task_id}"
        response = client.show_sync_task(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
38
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.ShowSyncTaskRequest{}
	request.SyncTaskId = "{sync_task_id}"
	response, err := client.ShowSyncTask(request)
	if err == nil {
        fmt.Printf("%+v\n", response)
    } else {
        fmt.Println(err)
    }
}

For SDK code examples in more programming languages, visit API Explorer and click the Sample Code tab. Example code can be automatically generated.

Status Codes

Status Code

Description

200

OK

404

Not Found

Error Codes

For details, see Error Codes.