Query Replication Task Comparison Tasks
Use the replication task ID to query its associated full-data comparison, incremental-data comparison, and schema comparison tasks.
Request URL: /openapi/v1/replication/compareTasks
Request Method: GET
Before You Call
- Configure the AccessKey, request timestamp, and signature as described in Call NineData OpenAPI.
- Obtain
replicationIdfrom Query Replication Tasks. - The caller must have both the
DataCompareandSchemaComparemodule permissions.
Request Parameters
| Parameter | Location | Type | Required | Description | Example |
|---|---|---|---|---|---|
| replicationId | Query | String | Yes | Replication task ID. The API only queries comparison tasks associated with replication tasks in the organization of the current AccessKey. | rp-example001 |
Request Example
GET requests do not have a request body. Prepare the request parameter in the following JSON structure and send replicationId as a query parameter:
{
"replicationId": "rp-example001"
}
Response Parameters
| Parameter | Type | Description | Example |
|---|---|---|---|
| success | Boolean | Whether the request was successful. | true |
| requestId | String | Request ID for troubleshooting and tracing. | <requestId> |
| data | Object | Associated comparison task information returned on success. This field may be absent when the request fails. | See the example below |
| message | String | Error message returned when the business request fails. | replication rp-example001 not found |
data Fields
| Parameter | Type | Description | Example |
|---|---|---|---|
| replicationId | String | Replication task ID from the request. | rp-example001 |
| compareData | Array | Full-data comparison task list. | See the example below |
| compareIncData | Array | Incremental-data comparison task list. Returns an empty array when no associated task exists. | [] |
| compareSchema | Array | Schema comparison task list. | See the example below |
Comparison Task Object Fields
Elements in the compareData, compareIncData, and compareSchema arrays contain the following fields. The task type is implied by the array that contains the element.
| Parameter | Type | Description | Example |
|---|---|---|---|
| id | String | Comparison task ID. Use an ID from compareData or compareIncData with data comparison APIs, and an ID from compareSchema with schema comparison APIs. | cd-example001 |
| referenceType | Number | Association type. Comparison tasks associated with a replication task always return 1. | 1 |
| status | String | Comparison task status. | success |
| isDeleted | Boolean | Whether the comparison task has been deleted. | false |
Successful Invocation Example
{
"success": true,
"requestId": "<requestId>",
"data": {
"replicationId": "rp-example001",
"compareData": [
{
"id": "cd-example001",
"referenceType": 1,
"status": "success",
"isDeleted": false
}
],
"compareIncData": [],
"compareSchema": [
{
"id": "cc-example001",
"referenceType": 1,
"status": "success",
"isDeleted": false
}
]
}
}
Error Conditions
| Scenario | Response |
|---|---|
The replication task identified by replicationId does not exist or is not in the current organization | Returns success=false and an error message similar to replication <replicationId> not found in message. |
The AccessKey does not have both the DataCompare and SchemaCompare module permissions | The request is rejected by the permission check. Check the module permissions of the AccessKey owner. |
| The request signature is missing or invalid, or the timestamp is invalid | The request is rejected during authentication. See Call NineData OpenAPI for request header and signature requirements. |
Result
compareData,compareIncData, andcompareSchemacan be empty arrays. Your client must handle the case where no associated comparison task exists.- The comparison task objects returned by this API contain only
id,referenceType,status, andisDeleted. To view task configuration, execution information, or comparison results, call the corresponding comparison task detail API. - Use IDs from
compareDataandcompareIncDatawith Query Data Comparison Main Task Details, and use IDs fromcompareSchemawith Query Schema Comparison Main Task Details.