Updated on 2026-09-07 GMT+08:00

Selecting Database Objects in Batches

Function

This API is used to select the databases or tables to be migrated.

Debugging

You can debug the API in API Explorer to support automatic authentication. API Explorer can automatically generate and debug example SDK code.

Constraints

  • Only real-time migration, real-time synchronization, and verification tasks support object selection.
  • After a task is created, the task status is CONFIGURATION. The task can be invoked only after the test of connections to the source and destination databases is successful and the API for modifying the task is invoked.
  • To ensure API performance, it is recommended that a single batch contain no more than 10 tasks.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions. For details about the required permissions, see Permissions and Supported Actions.

URI

PUT /v3/{project_id}/jobs/batch-select-objects

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Project ID of a tenant in a region.

For details about how to obtain the project ID, see Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Definition

MIME type of the request body. Use the default value application/json. For APIs used to upload objects or images, the value varies depending on the flow type.

Constraints

N/A

Range

application/json

Default Value

application/json

X-Auth-Token

Yes

String

Definition

User token obtained from IAM. It is a response to the API for obtaining a user token. This API is the only one that does not require authentication. The token is the value of X-Subject-Token in the response header.

Constraints

N/A

Range

N/A

Default Value

N/A

X-Language

No

String

Definition

Request language type.

Constraints

N/A

Range

  • en-us: English
  • zh-cn: Chinese

Default Value

en-us

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

jobs

Yes

Array of objects

Definition

List of tasks for updating database object selections in batches. Each element contains the object selection configuration of a task.

For details, see Table 4.

Constraints

It is recommended that a single batch contain no more than 10 tasks.

Table 4 Data structure description of field jobs

Parameter

Mandatory

Type

Description

job_id

Yes

String

Definition

Task ID, which uniquely identifies a data replication task and serves as the identifier for operations such as query, modification, and deletion.

Constraints

N/A

Range

N/A

Default Value

N/A

selected

No

Boolean

Definition

Whether to select specific objects. You can choose to migrate all objects or only specific objects.

Constraints

N/A

Range

  • true: specific objects. You need to specify the objects using the job field.

  • false: all objects

Default Value

false

sync_database

No

Boolean

Definition

Whether to perform database-level synchronization. That means whether to select objects by database.

Constraints

N/A

Range

  • true: database-level synchronization

  • false: not database-level synchronization

Default Value

N/A

job

No

Array of objects

Definition

Data object selection information, which includes detailed configurations of objects such as databases, tables, and views to be migrated.

For details, see Table 5.

Constraints

This parameter is mandatory when selected is set to true.

Table 5 Data structure description of field job

Parameter

Mandatory

Type

Description

id

No

String

Definition

ID of a database object. The specific meaning depends on the value of object_type. When object_type is set to database, this parameter indicates the database name. If object_type is set to table or view, set this parameter by referring to the example.

Constraints

N/A

Range

N/A

Default Value

N/A

parent_id

No

String

Definition

Parent ID of a database object. This parameter is mandatory when object_type is set to table or view. The value is a database name.

Constraints

This parameter is mandatory when object_type is set to table or view.

Range

N/A

Default Value

N/A

object_type

No

String

Definition

Type of a database object, which is used to identify whether the migration or synchronization object is a database, table, schema, or view.

Constraints

N/A

Range

  • database
  • table
  • schema
  • view

Default Value

N/A

object_name

No

String

Definition

Database object name, which can be a database name, table name, or view name.

Constraints

N/A

Range

N/A

Default Value

N/A

select

No

String

Definition

Whether to select the database object for migration. This parameter is used to control object selection for migration.

Constraints

N/A

Range

  • true: selected. The database object will be migrated.

  • false: not selected. The database object will not be migrated.

  • partial: partial selection. Only certain tables in the database will be migrated.

Default Value

false

object_alias_name

No

String

Definition

Alias, which is the new name after mapping.

Constraints

This parameter is available only for synchronization tasks.

Range

N/A

Default Value

N/A

Response Parameters

Status code: 202

Table 6 Response body parameters

Parameter

Type

Description

all_counts

Long

Definition

Total number of object selection tasks in a batch.

Constraints

N/A

Range

N/A

results

Array of objects

Definition

Response list for selecting objects in batches.

For details, see Table 7.

Table 7 Data structure description of field results

Parameter

Type

Description

job_id

String

Definition

Task ID, which uniquely identifies a data replication task and serves as the identifier for operations such as query, modification, and deletion.

Constraints

N/A

Range

N/A

status

Boolean

Definition

Whether the object selection task is successful.

Constraints

N/A

Range

  • true: The object selection task is successful.
  • false: The object selection task failed.

error_code

String

Definition

Error code returned if the task fails.

Constraints

N/A

Range

N/A

error_msg

String

Definition

Error message returned if the task fails.

Constraints

N/A

Range

N/A

Example Request

  • Selecting specified databases and tables for migration
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-select-objects
    
    {
      "jobs" : [ {
        "job" : [ {
          "id" : "fastunit",
          "parent_id" : null,
          "object_name" : "fastunit",
          "object_type" : "database",
          "select" : "partial",
          "object_alias_name" : null
        }, {
          "id" : "fastunit-*-*-coll",
          "parent_id" : "fastunit",
          "object_name" : "coll",
          "object_type" : "table",
          "select" : "true",
          "object_alias_name" : null
        }, {
          "id" : "ycy1",
          "parent_id" : null,
          "object_name" : "ycy1",
          "object_type" : "database",
          "select" : "partial",
          "object_alias_name" : null
        }, {
          "id" : "ycy1-*-*-coll",
          "parent_id" : "ycy1",
          "object_name" : "coll",
          "object_type" : "table",
          "select" : "true",
          "object_alias_name" : null
        }, {
          "id" : "ycy1-*-*-collcount",
          "parent_id" : "ycy1",
          "object_name" : "collcount",
          "object_type" : "table",
          "select" : "true",
          "object_alias_name" : null
        } ],
        "job_id" : "57fd2692-0ebe-4714-9b59-fe7aa65djb15",
        "selected" : true
      } ]
    }
  • Selecting all objects for migration
    https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-select-objects
    
    {
      "jobs" : [ {
        "job" : [ ],
        "job_id" : "e59f5eef-2bcc-4461-b9ac-10aded44jb15",
        "selected" : false
      } ]
    }

Example Response

Status code: 202

Accepted

{
	"all_counts": 1,
	"results": [{
		"job_id": "4d700f6f-9a17-47e0-a7d6-1bc2155jb101",
		"status": true
	}]
}

Status Code

Status Code

Description

202

Accepted

400

Bad Request

For other statuses, see Status Code.

Error Code

For details, see Error Code.