Querying the List of Migration Tasks

Function

This API is used to query the information about all tasks under a user account.

Debugging

You can debug this API in API Explorer.

URI

GET /v2/{project_id}/tasks

Table 1 Path parameter

Parameter

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

Minimum length: 1 character

Maximum length: 1,024 characters

Table 2 Query parameters

Parameter

Mandatory

Type

Description

group_id

No

String

Specifies the ID of a migration task group.

Minimum length: 1 character

Maximum length: 100 characters

limit

No

Integer

Specifies the maximum number of migration tasks displayed on one page. A maximum of 100 migration tasks can be displayed.

Minimum value: 1

Maximum value: 100

Default value: 10

offset

No

Integer

Specifies the start serial number of migration tasks. The value must be greater than or equal to 0. If offset is set to 0, the query starts from the first task record.

Minimum value: 0

Maximum value: 10000

Default value: 0

status

No

Integer

Specifies the migration task status. If this parameter is not specified, migration tasks in all statuses will be queried. The value can be 1 (Waiting to migrate), 2 (Migrating), 3 (Migration paused), 4 (Migration failed), or 5 (Migration succeeded).

Minimum value: 1

Maximum value: 5

Request

Table 3 Request header parameter

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Specifies 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

tasks

Array of TaskResp objects

Specifies the details of queried migration tasks.

count

Long

Specifies the total number of the migration tasks that meet the search criteria.

Minimum value: 0

Maximum value: 9223372036854775807

Table 5 TaskResp field description

Parameter

Type

Description

bandwidth_policy

Array of BandwidthPolicyDto objects

Specifies the traffic limit rules. A maximum of five traffic limit rules can be set for each task.

complete_size

Long

Specifies the size (in bytes) of the objects that have been migrated in the task.

Minimum value: 0

Maximum value: 9223372036854775807

description

String

Describes the migration task. This field can be left blank.

Minimum length: 0 characters

Maximum length: 255 characters

dst_node

DstNodeResp object

Specifies the destination node information.

enable_failed_object_recording

Boolean

Specifies whether to record the objects that failed to be migrated. If this function is enabled, information about objects that fail to be migrated will be stored in the destination bucket.

enable_kms

Boolean

Specifies whether to use KMS to encrypt the data to be stored in the destination OBS bucket.

enable_restore

Boolean

Specifies whether to restore archive data in the source bucket. It takes a long time to restore archive data in the source bucket, which will greatly slow the migration speed. You are advised to restore the archive objects before migration. After this function is enabled, archive objects will be automatically restored and then migrated. By default, this function is disabled. Archive objects will be ignored during the migration and the information about these objects will be recorded in the list of failed objects.

error_reason

ErrorReasonResp object

Specifies the task failure cause. This field is left blank when the task is not in the Migration failed state.

failed_num

Long

Specifies the number of objects that failed to be migrated.

Minimum value: 0

Maximum value: 9223372036854775807

failed_object_record

FailedObjectRecordDto object

Specifies whether the failed objects are recorded successfully. If the record is successful, the storage path for the failed object list is provided. If the record fails, the failure cause is displayed.

group_id

String

Specifies the ID of migration task group to which the task belongs. If a task is created by a migration task group, the ID of the migration task group is included.

Minimum length: 0 characters

Maximum length: 36 characters

id

Long

Specifies the task ID.

Minimum value: 0

Maximum value: 999999999999999

is_query_over

Boolean

Specifies whether the source object statistics are scanned for the migration task.

left_time

Long

Specifies the remaining time (in milliseconds) of the task.

Minimum value: 0

Maximum value: 9223372036854775807

migrate_since

Long

Specifies the specified migration time (timestamp, in milliseconds). Only source objects that are modified after the specified time will be migrated. Default value 0 indicates that no time is specified.

Minimum value: 0

Maximum value: 9223372036854775807

migrate_speed

Long

Specifies the migration speed (byte/s).

Minimum value: 0

Maximum value: 9223372036854775807

name

String

Specifies the task name.

Minimum length: 0 characters

Maximum length: 10,240 characters

progress

Double

Specifies the task progress. For example, 0.522 represents the progress is 52.2%, and 1 represents the progress is 100%.

Minimum value: 0

Maximum value: 1

real_size

Long

Specifies the total size (in bytes) of the migrated objects. The size of ignored objects is not counted.

Minimum value: 0

Maximum value: 9223372036854775807

skipped_num

Long

Specifies the number of objects that are ignored during the migration. The following objects will be ignored: objects whose last modification time is earlier than the specified migration time, and objects that exist in the destination bucket.

Minimum value: 0

Maximum value: 9223372036854775807

src_node

SrcNodeResp object

Specifies the source node information.

start_time

Long

Specifies the start time (UNIX timestamp, in milliseconds) of the migration task.

Minimum value: 0

Maximum value: 9223372036854775807

status

Integer

Specifies the task status. 1: Waiting to migrate; 2: Migrating; 3: Migration paused; 4: Migration failed; 5: Migration succeeded.

Minimum value: 1

Maximum value: 5

successful_num

Long

Specifies the number of successfully migrated objects.

Minimum value: 0

Maximum value: 9223372036854775807

task_type

String

Specifies the task type. list indicates migrating objects using an object list. object indicates migrating selected files or folders. prefix indicates migrating objects with specified prefixes. url_list indicates migrating objects using a URL object list.

Default value: object

Value options are as follows:

  • list
  • object
  • prefix
  • url_list

group_type

String

Specifies the task group type. NORMAL_TASK indicates a general migration task. SYNC_TASK indicates a migration task to which a synchronization task belongs. GROUP_TASK indicates a subtask in a migration task group.

Default value: NORMAL_TASK

Value options are as follows:

  • NORMAL_TASK
  • SYNC_TASK
  • GROUP_TASK

total_num

Long

Specifies the total number of the objects that have been migrated in the task.

Minimum value: 0

Maximum value: 9223372036854775807

total_size

Long

Specifies the size (in bytes) of the objects that have been migrated in the task.

Minimum value: 0

Maximum value: 9223372036854775807

total_time

Long

Specifies the total time used (in milliseconds).

Minimum value: 0

Maximum value: 9223372036854775807

smn_info

SmnInfo object

Specifies the SMN notification results.

source_cdn

SourceCdnResp object

Specifies whether to enable CDN during the migration. If CDN is enabled, the source objects to be migrated are obtained from the CDN domain name during migration. If this field is included, CDN is supported. Otherwise, CDN is not supported.

success_record_error_reason

String

Specifies the error code returned for the failure in recording the list of objects that are successfully migrated. If the list is recorded successfully, this parameter is left blank.

Minimum length: 0 characters

Maximum length: 255 characters

skip_record_error_reason

String

Specifies the error code returned for the failure in recording the list of objects that are ignored. If the list is recorded successfully, this parameter is left blank.

Minimum length: 0 characters

Maximum length: 255 characters

Table 6 BandwidthPolicyDto field description

Parameter

Type

Description

end

String

Specifies the end time of the traffic limit rule. The format is hh:mm, for example, 12:03.

max_bandwidth

Long

Specifies the maximum traffic bandwidth allowed in the specified time segment. The unit is byte/s. The value ranges from 1048576 bytes/s (equivalent to 1 MB/s) to 209715200 bytes/s (equivalent to 200 MB/s).

Minimum value: 1048576

Maximum value: 209715200

start

String

Specifies the start time of the traffic limit rule. The format is hh:mm, for example, 12:03.

Table 7 DstNodeResp

Parameter

Type

Description

bucket

String

Specifies the name of the destination bucket.

Maximum length: 1,024 characters

region

String

Specifies the region where the destination bucket is located.

The value must be the same as that of the service endpoint.

Minimum length: 0 characters

Maximum length: 100 characters

save_prefix

String

Specifies the path prefix in the destination bucket. The prefix is added before the object key to form a new key. The length of the new key cannot exceed 1,024 characters.

Minimum length: 0 characters

Maximum length: 1,024 characters

Table 8 ErrorReasonResp

Parameter

Type

Description

error_code

String

Specifies the returned error code for a migration failure.

Minimum length: 0 characters

Maximum length: 10 characters

error_msg

String

Specifies the migration failure cause.

Minimum length: 0 characters

Maximum length: 1,024 characters

Table 9 FailedObjectRecordDto field description

Parameter

Type

Description

result

Boolean

Specifies whether to retransmit the failed objects.

list_file_key

String

Specifies the path for storing the failed object list file.

Minimum length: 0 characters

Maximum length: 1,024 characters

error_code

String

Specifies the error code returned when the list of failed objects fails to be uploaded.

Minimum length: 0 characters

Maximum length: 10 characters

Table 10 SrcNodeResp field description

Parameter

Type

Description

bucket

String

Specifies the name of the source bucket.

Minimum length: 0 characters

Maximum length: 1,024 characters

cloud_type

String

Specifies the source cloud service provider.

The value can be AWS, Azure, Aliyun, Tencent, HuaweiCloud, QingCloud, KingsoftCloud, Baidu, Qiniu, URLSource, or UCloud. The default value is Aliyun.

Value options are as follows:

  • AWS
  • Azure
  • Aliyun
  • Tencent
  • HuaweiCloud
  • QingCloud
  • KingsoftCloud
  • Baidu
  • Qiniu
  • URLSource
  • UCloud

region

String

Specifies the region where the source bucket is located.

Minimum length: 0 characters

Maximum length: 100 characters

app_id

String

This parameter is returned when cloud_type is Tencent.

Minimum length: 0 characters

Maximum length: 255 characters

object_key

Array of strings

If the task_type is object, this parameter indicates the names of the objects to be migrated. If the task_type is prefix, this parameter indicates the name prefixes of the objects to be migrated.

list_file

ListFile object

Specifies the list file configuration. list_file is mandatory when task_type is set to list or url_list.

Table 11 ListFile field description

Parameter

Type

Description

list_file_key

String

Specifies the object names in the object list file or URL list file.

Minimum length: 1 character

Maximum length: 1,024 characters

obs_bucket

String

Specifies the name of the OBS bucket for storing the object list files.

Ensure that the OBS bucket is in the same region as the destination bucket, or the task will fail to be created.

Minimum length: 0 characters

Maximum length: 1,024 characters

Table 12 SmnInfo field description

Parameter

Type

Description

notify_result

Boolean

Specifies whether the SMN messages are sent successfully after migration tasks are complete.

notify_error_message

String

Specifies the error codes that record why the SMN messages failed to be sent. The value is empty if migration tasks are successful.

Minimum length: 0 characters

Maximum length: 1,024 characters

topic_name

String

Specifies the SMN topic name. The value is empty if SMN messages are sent successfully.

Minimum length: 0 characters

Maximum length: 5,120 characters

Table 13 SourceCdnResp field description

Parameter

Type

Description

domain

String

Specifies the domain name from which to obtain objects to be migrated.

Minimum length: 0 characters

Maximum length: 1,024 characters

protocol

String

Specifies the protocol type.

Value options are as follows:

  • HTTP
  • HTTPS

authentication_type

String

Specifies the authentication type.

Value options are as follows:

  • NONE
  • QINIU_PRIVATE_AUTHENTICATION
  • ALIYUN_OSS_A
  • ALIYUN_OSS_B
  • ALIYUN_OSS_C
  • KSYUN_PRIVATE_AUTHENTICATION
  • AZURE_SAS_TOKEN

Status code: 400

Table 14 Response body parameters

Parameter

Type

Description

error_msg

String

Specifies the error message.

error_code

String

Specifies the error code.

Example Request

Query 10 failed tasks under the project whose ID is 2c0689c860ad4728a497c91ec0844383.

GET https://{endpoint}/v2/2c0689c860ad4728a497c91ec0844383/tasks?offset=0&limit=10&status=4

{
  "count" : 2,
  "tasks" : [ {
    "bandwidth_policy" : [ {
      "start" : "00:00",
      "end" : "15:00",
      "max_bandwidth" : 5242880
    } ],
    "complete_size" : 102608606,
    "description" : "Aliyun_API_Sonar",
    "dst_node" : {
      "region" : "cn-north-1",
      "bucket" : "oms-sonar-north1"
    },
    "enable_failed_object_recording" : true,
    "enable_kms" : false,
    "enable_restore" : false,
    "error_reason" : {
      "error_code" : "TRF.0001",
      "error_msg" : "System error. Click the restart button to try to start the migration task."
    },
    "failed_num" : 7,
    "failed_object_record" : {
      "result" : true,
      "list_file_key" : "oms/failed_object_lists/oms-north1-20200407164335723_487.failed_list.txt"
    },
    "group_id" : "null",
    "id" : 191297407830872,
    "is_query_over" : true,
    "left_time" : 0,
    "migrate_since" : 0,
    "migrate_speed" : 780973,
    "name" : "oms-north1-20200407164335723_487",
    "progress" : 0.998,
    "real_size" : 102465246,
    "skipped_num" : 99,
    "src_node" : {
      "region" : "cn-beijing",
      "bucket" : "api-auto-test1",
      "object_key" : [ "10000" ],
      "list_file" : "",
      "cloud_type" : "Aliyun"
    },
    "start_time" : 1586249019394,
    "status" : 4,
    "successful_num" : 19895,
    "task_type" : "prefix",
    "thread_num" : 50,
    "total_num" : 20001,
    "total_size" : 102629086,
    "total_time" : 131202,
    "smn_info" : "smn",
    "source_cdn" : "source_cdn"
  }, {
    "bandwidth_policy" : [ {
      "start" : "00:00",
      "end" : "15:00",
      "max_bandwidth" : 5242880
    } ],
    "complete_size" : 102608606,
    "description" : "Aliyun_API_Sonar",
    "dst_node" : {
      "region" : "cn-north-1",
      "bucket" : "oms-sonar-north1"
    },
    "enable_failed_object_recording" : true,
    "enable_kms" : false,
    "enable_restore" : false,
    "error_reason" : {
      "error_code" : "TRF.0001",
      "error_msg" : "System error. Click the restart button to try to start the migration task."
    },
    "failed_num" : 7,
    "failed_object_record" : {
      "result" : true,
      "list_file_key" : "oms/failed_object_lists/oms-north1-20200407164335723_487.failed_list.txt"
    },
    "group_id" : "null",
    "id" : 191297407830872,
    "is_query_over" : true,
    "left_time" : 0,
    "migrate_since" : 0,
    "migrate_speed" : 780973,
    "name" : "oms-north1-20200407164335723_487",
    "progress" : 0.998,
    "real_size" : 102465246,
    "skipped_num" : 99,
    "src_node" : {
      "region" : "cn-beijing",
      "bucket" : "bucket_name",
      "object_key" : [ "10000" ],
      "list_file" : "",
      "cloud_type" : "Aliyun"
    },
    "start_time" : 1586249019394,
    "status" : 4,
    "successful_num" : 19895,
    "task_type" : "prefix",
    "thread_num" : 50,
    "total_num" : 20001,
    "total_size" : 102629086,
    "total_time" : 131202,
    "smn_info" : "smn",
    "source_cdn" : "source_cdn"
  } ]
}

Example Response

None

Status Codes

Status Code

Description

200

OK

400

Bad Request

Error Codes

See Error Codes.