Run a database on several servers
const url = 'https://opfield.example.com/api/databases/managed/550e8400-e29b-41d4-a716-446655440000/availability';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"nodeIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"witness":{"relayIds":["2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"],"nodeId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"},"durability":"synchronous","manual":true,"priorityMode":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://opfield.example.com/api/databases/managed/550e8400-e29b-41d4-a716-446655440000/availability \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "nodeIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "witness": { "relayIds": [ "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" ], "nodeId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }, "durability": "synchronous", "manual": true, "priorityMode": true }'Turns availability on: the database keeps serving from its server, the copies are seeded in the background (202). Refused with 409 AVAILABILITY_PREFLIGHT_FAILED and the blockers, and with 409 AVAILABILITY_OPERATION_PENDING while another availability operation runs (details.kind, details.step: wait until the availability view shows no operation, then retry); every changing availability route and the delete of the database answer the same. manual: true makes a replicated pair of exactly two servers without automatic failover. 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
object
Responses
Section titled “Responses”Started
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"}