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
| 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
| 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
Default Value en-us |
| 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. |
| 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 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 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. |
Response Parameters
Status code: 202
| 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. |
| 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
|
| 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.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot