Help Center/ Distributed Database Middleware/ API Reference/ APIs (Recommended)/ Schemas/ Changing a Route Switching Policy (a V3 API)
Updated on 2026-05-30 GMT+08:00

Changing a Route Switching Policy (a V3 API)

Function

This API is used to change a route switching policy.

URI

PUT /v3/{project_id}/instances/{instance_id}/databases/{db_name}/migration/jobs/{job_id}/route-switch-strategy

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region

instance_id

Yes

String

DDM instance ID

db_name

Yes

String

Schema name

job_id

Yes

String

Workflow ID. For details about how to obtain the value of this parameter, see Configuring Shards (a V3 API).

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token

The token can be obtained by calling the IAM API used to obtain a user token. The value of X-Subject-Token in the response header is the user token.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

project_id

No

String

Project ID

instance_id

No

String

Instance ID

task_id

No

String

Task ID

switch_route_begin_time

No

String

Time when the automatic route switching starts (in the hh:mm:ss format, for example, 17:00:00)

  • If switch_route_begin_time and switch_route_end_time are not included in the request body, a manual route switching policy is used.
  • The interval between the start time and end time cannot exceed 1 hour.

switch_route_end_time

No

String

Time when the automatic route switching ends (in the hh:mm:ss format, for example, 18:00:00)

  • If switch_route_begin_time and switch_route_end_time are not included in the request body, a manual route switching policy is used.
  • The interval between the start time and end time cannot exceed 1 hour.

is_open_api

No

Boolean

Whether this is an open API.

logic_db_name

No

String

Schema name

Response Parameters

Status code: 200

None

Status code: 400

Table 4 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Status code: 500

Table 5 Response body parameters

Parameter

Type

Description

error_code

String

Error code

error_msg

String

Error message

Example Request

Configuring an automatic route switching policy
PUT https://{endpoint}/v3/{project_id}/instances/{instance_id}/databases/{db_name}/migration/jobs/{job_id}/route-switch-strategy

{
  "switch_route_begin_time": "17:00:00",
  "switch_route_end_time": "18:00:00"
}

Configuring a manual route switching policy
PUT https://{endpoint}/v3/619d3e78f61b4be68bc5aa0b59edcf7b/instances/1f5c9fd6cd984056ba89c8c87cc03278in09/databases/ddm_db_test/migration/jobs/10501cd3-0c19-498b-9ba4-8935ed447542/route-switch-strategy

Example Response

Status code: 200

{ }

Status code: 400

Bad request

{
  "error_msg" : "Parameter error.",
  "error_code" : "DBS.280001"
}

Status code: 500

Server error

{
  "error_msg" : "Parameter error.",
  "error_code" : "DBS.280001"
}

Status Codes

Status Codes

Description

200

OK

400

Bad request

500

Server error

Error Codes

For details, see Error Codes.