Updated on 2026-09-07 GMT+08:00

Querying User Comparison Details

Function

This API is used to query user comparison details.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, no identity policy-based permissions are required for calling this API.

URI

GET /v5/{project_id}/jobs/{job_id}/compare/users/{compare_job_id}

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region. For details about how to obtain the project ID, see Obtaining a Project ID.

job_id

Yes

String

Task ID.

compare_job_id

Yes

String

ID of a comparison task.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

offset

No

String

Offset. The records after this offset will be queried. The default value is 0.

limit

No

String

Maximum number of records that can be returned. The default value is 10.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

No

String

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.

X-Auth-Token

Yes

String

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.

After a request is processed, the value of X-Subject-Token in the header is the token value.

X-Language

No

String

Request language type

Enumerated values:

  • en-us

  • zh-cn

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

total_count

Integer

Total number of user comparison items.

user_compare_info

Array of objects

User comparison information.

For details, see CompareUserInfo.

Table 5 CompareUserInfo

Parameter

Type

Description

id

String

ID.

src_user_name

String

Account name of the source database.

tar_user_name

String

Account name of the destination database.

src_privileges

String

Source database account permissions.

tar_privileges

String

Destination database account permissions.

is_target_existed

Boolean

Whether the destination database exists. The value can be:

  • false: The destination database does not exist.

  • true: The destination database exists.

compare_result

Integer

Comparison result. The value can be:

  • INCONSISTENT: The information is inconsistent.

  • UNABLE_TO_COMPARE: The comparison cannot be performed.

  • CONSISTENT: The information is consistent.

  • TARGET_SCHEMA_NOT_EXIST: The destination database does not exist.

  • COMPARE_FAILED: The comparison failed.

  • COMPARING: The comparison is in progress.

  • WAITING_COMPARE: The comparison is waiting to start.

  • UNKNOWN: An unknown error occurred.

created_at

String

Creation time.

updated_at

String

Update time.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

https://{endpoint}/v5/054ba152d480d55b2f5dc0069e7ddef0/jobs/c7debc9c-8e09-4a5d-8dd6-cc44f78jb20r/compare/users/fc77e18b-21c8-4040-96b5-ae599d3jb201

Example Response

Status code: 200

{
  "total_count" : 3,
  "user_compare_info" : [ {
    "id" : "acc-1001",
    "src_user_name" : "job-20251201-001",
    "tar_user_name" : "db_user_001",
    "src_privileges" : "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE ROLE, DROP ROLE ON *.* TO `root`@`%` WITH GRANT OPTION;GRANT XA_RECOVER_ADMIN ON *.* TO `root`@`%` WITH GRANT OPTION",
    "tar_privileges" : "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, PROCESS, REFERENCES, INDEX, ALTER, SHOW DATABASES, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE ROLE, DROP ROLE ON *.* TO `root`@`%` WITH GRANT OPTION;GRANT XA_RECOVER_ADMIN ON *.* TO `root`@`%` WITH GRANT OPTION",
    "is_target_existed" : true,
    "compare_result" : 2,
    "created_at" : "2025-12-01T10:30:45Z",
    "updated_at" : "2025-12-01T14:22:10Z"
  } ]
}

Status code: 400

Bad Request

{
  "error_code" : "DRS.M00202",
  "error_msg" : "The value of limit is invalid."
}

Status Codes

Status Code

Description

200

OK

400

Bad Request

For other statuses, see Status Code.

Error Code

For details, see Error Code.