Skip to main content

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 replicationId from Query Replication Tasks.
  • The caller must have both the DataCompare and SchemaCompare module permissions.

Request Parameters

ParameterLocationTypeRequiredDescriptionExample
replicationIdQueryStringYesReplication 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

ParameterTypeDescriptionExample
successBooleanWhether the request was successful.true
requestIdStringRequest ID for troubleshooting and tracing.<requestId>
dataObjectAssociated comparison task information returned on success. This field may be absent when the request fails.See the example below
messageStringError message returned when the business request fails.replication rp-example001 not found

data Fields

ParameterTypeDescriptionExample
replicationIdStringReplication task ID from the request.rp-example001
compareDataArrayFull-data comparison task list.See the example below
compareIncDataArrayIncremental-data comparison task list. Returns an empty array when no associated task exists.[]
compareSchemaArraySchema 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.

ParameterTypeDescriptionExample
idStringComparison task ID. Use an ID from compareData or compareIncData with data comparison APIs, and an ID from compareSchema with schema comparison APIs.cd-example001
referenceTypeNumberAssociation type. Comparison tasks associated with a replication task always return 1.1
statusStringComparison task status.success
isDeletedBooleanWhether 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

ScenarioResponse
The replication task identified by replicationId does not exist or is not in the current organizationReturns 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 permissionsThe 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 invalidThe request is rejected during authentication. See Call NineData OpenAPI for request header and signature requirements.

Result

  • compareData, compareIncData, and compareSchema can 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, and isDeleted. To view task configuration, execution information, or comparison results, call the corresponding comparison task detail API.
  • Use IDs from compareData and compareIncData with Query Data Comparison Main Task Details, and use IDs from compareSchema with Query Schema Comparison Main Task Details.