Update Replication Task
Updates the source and target data sources, replication options, and object scope of a specified replication task.
Request URL: /openapi/v1/replication/update
Request Method: POST
Limits
- Only replication tasks that have not been started can be updated.
- Updating the replication task specification through OpenAPI is not supported.
Request Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| replicationId | String | Yes | Replication task ID. | rp-div1e4z3z3g3 |
| sourceDatasourceType | String | Yes | Source data source type. | mongodb |
| sourceDatasourceId | String | Yes | Source data source ID. You can query it by calling List Data Sources. | ds-source001 |
| targetDatasourceType | String | Yes | Target data source type. | mongodb |
| targetDatasourceId | String | Yes | Target data source ID. You can query it by calling List Data Sources. | ds-target001 |
| replicationOption | Object | Yes | Replication task options. See replicationOption Fields. | See the example below |
| objectConfig | Object | Yes | Replication object scope. See objectConfig Fields. | See the example below |
replicationOption Fields
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| migrateSchema | Boolean | No | Whether to replicate object schemas. The default value is true. | true |
| migrateData | Boolean | No | Whether to replicate existing data. The default value is true. | true |
| incrementalReplication | Boolean | No | Whether to replicate incremental data. The default value is false. | false |
| conflictStrategy | String | Yes | Data or schema conflict handling strategy. Values: ignore, abort, replace, drop_create. | ignore |
| supportDDL | Boolean | No | Whether DDL replication is supported. The default value is true. For the backward task of bidirectional replication, this value is fixed to false. | true |
objectConfig Fields
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| all | Boolean | No | Whether to include all objects in the instance. The default value is false. When set to true, databaseList is not required. | true |
| databaseList | Array | No | Database object list. Required when all=false. See Database or Schema Object Fields. | See the example below |
Database or Schema Object Fields
databaseList and schemaList use the same object structure. For a source with a database-table hierarchy, a databaseList element represents a database. For a source with a database-schema-table hierarchy, a schemaList element represents a schema.
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| all | Boolean | No | Whether to include all child objects under the current database or schema. The default value is false. | false |
| allTable | Boolean | No | Whether to include all tables. The default value is false. | true |
| allView | Boolean | No | Whether to include all views. The default value is false. | false |
| allTrigger | Boolean | No | Whether to include all triggers. The default value is false. | false |
| allEvent | Boolean | No | Whether to include all events. The default value is false. | false |
| allFunction | Boolean | No | Whether to include all functions. The default value is false. | false |
| allProcedure | Boolean | No | Whether to include all procedures. The default value is false. | false |
| schemaList | Array | No | Schema object list. Use this field for three-level source structures. Elements use the same fields as this table. | See the example below |
| tableList | Array | No | Specific table object list. Elements use Specified Object Fields. | See the example below |
| viewList | Array | No | Specific view object list. Elements use Specified Object Fields. | See the example below |
| functionList | Array | No | Specific function object list. Elements use Specified Object Fields. | See the example below |
| procedureList | Array | No | Specific procedure object list. Elements use Specified Object Fields. | See the example below |
| eventList | Array | No | Specific event object list. Elements use Specified Object Fields. | See the example below |
| triggerList | Array | No | Specific trigger object list. Elements use Specified Object Fields. | See the example below |
| ddlTriggerList | Array | No | Specific DDL trigger object list. Elements use Specified Object Fields. | See the example below |
| otherStoredObjectList | Array | No | Other stored object list. Elements use Specified Object Fields. | See the example below |
Specified Object Fields
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
| databaseName | String | Yes | Source database name. | db1 |
| targetDatabase | String | No | Target database name. Defaults to databaseName. | db1_target |
| schemaName | String | No | Source schema name. This field can be configured for three-level source structures. The default value is null. | public |
| targetSchema | String | No | Target schema name. This field can be configured for three-level target structures. The default value is null. | public_target |
| objectName | String | Yes | Source object name. | table_a |
| targetName | String | No | Target object name. Defaults to objectName. | table_a_target |
Request Example
{
"replicationId": "rp-div1e4z3z3g3",
"sourceDatasourceType": "mongodb",
"sourceDatasourceId": "ds-source001",
"targetDatasourceType": "mongodb",
"targetDatasourceId": "ds-target001",
"replicationOption": {
"migrateSchema": true,
"migrateData": true,
"incrementalReplication": false,
"conflictStrategy": "ignore",
"supportDDL": true
},
"objectConfig": {
"all": true
}
}
Response Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| success | Boolean | Whether the request was successful. | true |
| requestId | String | Request ID. | Tx1k9FHP-kqrjyGGnjnoo9QBdlsc3XBX |
| message | String | Message returned when the request fails. | replication rp-xxx not found |
Successful Invocation Example
{
"success": true,
"requestId": "Tx1k9FHP-kqrjyGGnjnoo9QBdlsc3XBX"
}