Update managed database configuration
const url = 'https://opfield.example.com/api/databases/managed/550e8400-e29b-41d4-a716-446655440000';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"name":"example","tags":["example"],"storageSizeGb":1,"cpuCores":1,"memoryMb":1,"swapMb":1,"publishTcp":true,"publishNativeTcp":true,"publishedPort":1,"publishedNativePort":1,"tlsEnabled":true,"clickhouseConfigXml":"example","redisConfig":{"maxmemoryPercent":1,"maxmemoryPolicy":"noeviction","appendOnly":true,"appendFsync":"always","rdbSnapshotsEnabled":true,"rdbSaveSeconds":1,"rdbSaveChanges":1,"autoAofRewritePercentage":1,"autoAofRewriteMinSizeMb":1,"maxclients":1,"timeoutSeconds":1,"tcpKeepaliveSeconds":1,"slowlogThresholdMicroseconds":1,"slowlogMaxLen":1,"activeDefrag":true},"postgresConfig":{"maxConnections":1},"version":"example","imageUpdate":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://opfield.example.com/api/databases/managed/550e8400-e29b-41d4-a716-446655440000 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "name": "example", "tags": [ "example" ], "storageSizeGb": 1, "cpuCores": 1, "memoryMb": 1, "swapMb": 1, "publishTcp": true, "publishNativeTcp": true, "publishedPort": 1, "publishedNativePort": 1, "tlsEnabled": true, "clickhouseConfigXml": "example", "redisConfig": { "maxmemoryPercent": 1, "maxmemoryPolicy": "noeviction", "appendOnly": true, "appendFsync": "always", "rdbSnapshotsEnabled": true, "rdbSaveSeconds": 1, "rdbSaveChanges": 1, "autoAofRewritePercentage": 1, "autoAofRewriteMinSizeMb": 1, "maxclients": 1, "timeoutSeconds": 1, "tcpKeepaliveSeconds": 1, "slowlogThresholdMicroseconds": 1, "slowlogMaxLen": 1, "activeDefrag": true }, "postgresConfig": { "maxConnections": 1 }, "version": "example", "imageUpdate": true }'Changes resources, version, publication and engine settings. version moves to a newer catalog version of the same engine: PostgreSQL within its major version (another major is a backup restored into a new database, 409 POSTGRES_MAJOR_CHANGE), Valkey and ClickHouse to the next catalog version (409 MANAGED_DATABASE_VERSION_STEP); the node recreates the container on the new image with the data kept (409 MANAGED_DATABASE_DAEMON_UPDATE_REQUIRED on an older node daemon). imageUpdate: true moves a PostgreSQL database from the official image of its version to Opfield’s image of the same version, which adds the extensions (data kept, one restart; 409 MANAGED_DATABASE_IMAGE_CURRENT when it already runs it or none is published yet). A database on several servers (availability on) takes the settings at once with status updating and changes its members one at a time: copies first, each until it is an eligible copy again, then a planned switchover to a changed copy when the primary must restart, then the old primary; availability.operation shows the rolling update, and the status goes back to ready (a stop part-way leaves lastError). TLS cannot be turned on or off there (409 AVAILABILITY_TLS_CHANGE); an older member daemon answers 409 AVAILABILITY_NODE_NOT_CAPABLE. A database in an app environment isolated by the kill switch is refused (409 APP_ISOLATED).
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
object
Responses
Section titled “Responses”Successful response
object
Resource object. Exact fields depend on the endpoint.
object
Example
{ "data": { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Production Postgres", "type": "postgres", "healthStatus": "online" }}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"}