Help Center/ Data Replication Service/ API Reference/ Application Examples/ Scenario 2: Querying Task Details in Batches
Updated on 2024-07-11 GMT+08:00

Scenario 2: Querying Task Details in Batches

Scenarios

This section describes how to query task details of a tenant by calling the API described in Querying Task Details in Batches.

Procedure

  1. Call an IAM API to obtain a user token by referring to Authentication.
  2. Obtain the ID of the task to be queried by referring to Obtaining a Task ID.
  3. URI format: /v3/{project_id}/jobs/batch-detail

    • Example request:

      POST: https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-detail

      Obtain the endpoint from Regions and Endpoints.

    • Request example:
      https://{endpoint}/v3/054ba152d480d55b2f5dc0069e7ddef0/jobs/batch-detail
      
      {
        "jobs" : [ "24834eb6-be30-464e-a299-f7aa730jb101", "140b5236-88ad-43c8-811c-1268453jb101" ],
        "page_req" : {
          "cur_page" : 1,
          "per_page" : 10
        }
      }
    • Example Response:
      {
        "count" : 2,
        "results" : [ {
          "id" : "24834eb6-be30-464e-a299-f7aa730jb101",
          "name" : "DRS-3999-lws",
          "status" : "STARTJOBING",
          "description" : "",
          "create_time" : "1608519469412",
          "task_type" : "FULL_INCR_TRANS",
          "source_endpoint" : {
            "ip" : "172.22.74.56",
            "region" : "cn-xianhz-1",
            "db_type" : "mysql",
            "db_port" : 3306,
            "ssl_link" : false,
            "project_id" : "054ba152d480d55b2f5dc0069e7ddef0",
            "db_user" : "root"
          },
          "target_endpoint" : {
            "ip" : "172.21.176.219",
            "region" : "cn-xianhz-1",
            "db_type" : "mysql",
            "db_port" : 3306,
            "ssl_link" : false,
            "inst_id" : "3ef57dbcc8db478a9e346d26ef2575bfin01",
            "project_id" : "054ba152d480d55b2f5dc0069e7ddef0",
            "inst_name" : "rds-lws-target",
            "db_user" : "root",
            "vpc_id" : "0ff8df7b-f0e9-4b16-ac16-1db3dacb69e4",
            "subnet_id" : "f857d371-2f03-4622-85f6-2b7d42d0d82c"
          },
          "inst_info" : {
            "ip" : "172.16.213.101",
            "inst_type" : "high",
            "engine_type" : "mysql",
            "volume_size" : 100,
            "public_ip" : "******",
            "start_time" : "0"
          },
          "actual_start_time" : "1608520069393",
          "update_time" : "1608520068979",
          "job_direction" : "up",
          "db_use_type" : "migration",
          "need_restart" : false,
          "is_target_readonly" : true,
          "speed_limit" : [ ],
          "schema_type" : "Tungsten",
          "object_switch" : true,
          "replace_definer" : true,
          "migrate_user" : false,
          "az_code" : "az2xahz",
          "vpc_id" : "0ff8df7b-f0e9-4b16-ac16-1db3dacb69e4",
          "subnet_id" : "f857d371-2f03-4622-85f6-2b7d42d0d82c",
          "security_group_id" : "d90c971b-4b9d-402c-9c59-5c239389b8dd",
          "support_ip_v6" : false,
          "original_job_direction": "up",
          "is_open_fast_clean": true,
          "object_infos":[{
            "id":"test",
            "type":"database",
            "name":"test",
            "select":"true"
            },{
            "id":"test-*-*-table01",
            "type":"table",
            "name":"table01",
            "select":"true",
            "parent_id":"test"
            }]
        }, {
          "id" : "140b5236-88ad-43c8-811c-1268453jb101",
          "name" : "DRS-0042-linxiaolu",
          "status" : "CONFIGURATION",
          "description" : "",
          "create_time" : "1608366204171",
          "task_type" : "FULL_INCR_TRANS",
          "source_endpoint" : {
            "ip" : "192.168.0.27",
            "region" : "cn-xianhz-1",
            "db_type" : "mysql",
            "db_port" : 3306,
            "ssl_link" : false,
            "project_id" : "054ba152d480d55b2f5dc0069e7ddef0",
            "db_user" : "root"
          },
          "target_endpoint" : {
            "ip" : "192.168.0.131",
            "region" : "cn-xianhz-1",
            "db_type" : "mysql",
            "db_port" : 3306,
            "ssl_link" : false,
            "inst_id" : "e05a3679efe241d8b5dee80b17c1a863in01",
            "project_id" : "054ba152d480d55b2f5dc0069e7ddef0",
            "inst_name" : "rds-1417-lxl",
            "db_user" : "root",
            "vpc_id" : "65f0391c-0582-44a6-aa50-248f97ed82e1",
            "subnet_id" : "352ad828-3467-4f03-987a-c55a5a9dd417"
          },
          "inst_info" : {
            "ip" : "192.168.0.229",
            "status" : "ACTIVE",
            "inst_type" : "high",
            "engine_type" : "mysql",
            "volume_size" : 100,
            "public_ip" : "10.154.219.72",
            "start_time" : "0"
          },
          "actual_start_time" : "1608369232412",
          "full_transfer_complete_time" : "1608369510202",
          "update_time" : "1608517066434",
          "job_direction" : "up",
          "db_use_type" : "migration",
          "need_restart" : false,
          "is_target_readonly" : true,
          "speed_limit" : [ ],
          "schema_type" : "Tungsten",
          "object_switch" : false,
          "replace_definer" : true,
          "migrate_user" : false,
          "tags": [{
             "key1" : "value1",
             "key2" : "value2"
           }],
          "az_code" : "az2xahz",
          "vpc_id" : "65f0391c-0582-44a6-aa50-248f97ed82e1",
          "subnet_id" : "352ad828-3467-4f03-987a-c55a5a9dd417",
          "security_group_id" : "d90c971b-4b9d-402c-9c59-5c239389b8dd",
          "support_ip_v6" : false,
          "original_job_direction": "up",
          "object_infos":[{
            "id":"test2",
            "type":"database",
            "name":"test2",
            "select":"true"
            },{
            "id":"test2-*-*-table02",
            "type":"table",
            "name":"table02",
            "select":"true",
            "parent_id":"test2"
            }]
        } ],
          "data_transformation": {
            "total_count": 2,
              "filter_conditions": [
                {
                  "data_transformation_object_infos": [
                    {
                      "id": "test02-*-*-table02-*-*---conditionFilter--",
                        "db_name": "test02",
                        "table_name": "table02",
                        "data_transformation_type": "contentConditionalFilter"
                     }
                   ],
                   "transformation_info": {
                     "value": "id1<1",
                       "transformation_type": "contentConditionalFilter"
                   }
                 },
                 {
                   "data_transformation_object_infos": [
                     {
                       "id": "test02-*-*-table01-*-*---configConditionFilter--",
                       "db_name": "test02",
                       "table_name": "test01",
                       "data_transformation_type": "configConditionalFilter"
                      }
                    ],
                    "transformation_info": {
                      "value": "config",
                      "transformation_type": "configConditionalFilter"
                    },
                    "config_transformation": {
                      "indexs": "id",
                      "values": "id <= 6",
                      "db_table_name": "test02.table01",
                      "db_name": "test02",
                      "table_name": "table01",
                      "col_names": "id",
                      "prim_key_or_index": "id"
                     }
                  }
               ]
           }
      }