Set the failover order of a database
const url = 'https://opfield.example.com/api/databases/managed/550e8400-e29b-41d4-a716-446655440000/availability/members/order';const options = { method: 'PUT', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"memberIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PUT \ --url https://opfield.example.com/api/databases/managed/550e8400-e29b-41d4-a716-446655440000/availability/members/order \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "memberIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ] }'memberIds lists every server of the set once, the preferred one first (400 INVALID_AVAILABILITY_MEMBER_ORDER otherwise). The order decides which copy takes over first when the primary fails and, with failback on (priorityMode), the server the primary moves back to: the first one, once it was eligible for the failback delay. Changing it never moves the primary by itself. The servers, the lease and the relays get the new order in the background (202); an unchanged order changes nothing. Refused while another availability operation runs (409 AVAILABILITY_OPERATION_PENDING). Needs databases:edit. Needs the current plan with multi-node availability (Business).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Example
550e8400-e29b-41d4-a716-446655440000Request Bodyrequired
Section titled “Request Bodyrequired”JSON request body
object
Examplegenerated
{ "memberIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ]}Responses
Section titled “Responses”Started (or unchanged)
object
object
Automatic | manual. manual: a replicated pair without automatic failover (no witness host); make a copy primary by hand
Converting | healthy | degraded | no_failover | failing_over | closing | error | paused (the resource is paused)
object
Synchronous | asynchronous
Auto | admin
What an unplanned failover can lose with this durability
object
Failover preference: higher first, then the older member. members lists the servers in this order, which PUT availability/members/order sets
Primary | copy | rebuilding | fenced | unknown
It still reports itself primary but lost the role in a failover (role shows unknown until it reports)
Whether this copy may take over now
Sync | async | none
Creating | ready | error | removing
Member | removing
The member reported recently
object
Lease | keeper
Relay | node
Active | standby
Servers the set can lose now and keep its primary role
object
How long failover keeps working while Opfield is down (the relay policy lease)
object
object
object
Set when the license no longer covers changes: turning on, adding servers, settings and the failover order are refused; everything else keeps working
Example
{ "data": { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Example resource" }}Bad request
object
Error code
Human-readable error message
Additional error details
Example
{ "code": "VALIDATION_ERROR", "message": "Request validation failed", "details": [ { "path": [ "name" ], "message": "Required" } ]}Authentication required
object
Error code
Human-readable error message
Additional error details
Example
{ "code": "UNAUTHORIZED", "message": "Authentication required"}Forbidden
object
Error code
Human-readable error message
Additional error details
Example
{ "code": "FORBIDDEN", "message": "Insufficient permissions"}Not found
object
Error code
Human-readable error message
Additional error details
Example
{ "code": "NOT_FOUND", "message": "Resource not found"}Conflict
object
Error code
Human-readable error message
Additional error details
Example
{ "code": "CONFLICT", "message": "Resource already exists"}Unprocessable entity
object
Error code
Human-readable error message
Additional error details
Example
{ "code": "UNPROCESSABLE_ENTITY", "message": "Request could not be processed"}Internal server error
object
Error code
Human-readable error message
Additional error details
Example
{ "code": "INTERNAL_ERROR", "message": "Internal server error"}