Turso Cloud API-Referenz Ressourcen Datenbanken
Datenbank wiederherstellen
Stelle eine innerhalb der letzten fünf Tage gelöschte Datenbank genau so wieder her, wie sie im Moment der Löschung war. Erfordert einen kostenpflichtigen Plan, eine Administrator- oder Owner-Rolle in der Organisation und aktivierte Wiederherstellung für die Organisation.
POST
https://api.turso.tech/v3/organizations/{organizationId}/databases/{databaseId}/restore HINWEIS
Im Gegensatz zu den v1-Endpoints identifiziert dieser Endpoint die Organisation und die Datenbank anhand ihrer UUID – verwende das Feld id aus
Retrieve Organization und das Feld DbId
aus List Deleted Databases.
curl -L -X POST 'https://api.turso.tech/v3/organizations/{organizationId}/databases/{databaseId}/restore' \
-H 'Authorization: Bearer TOKEN'
curl -L -X POST 'https://api.turso.tech/v3/organizations/{organizationId}/databases/{databaseId}/restore' \
-H 'Authorization: Bearer TOKEN' \
-H 'Content-Type: application/json' \
-d '{ "name": "my-restored-database" }'
OpenAPI
openapi: 3.0.1
info:
title: Turso Platform API
description: API description here
license:
name: MIT
version: 0.1.0
servers:
- url: https://api.turso.tech
description: Turso's Platform API
security: []
paths:
/v3/organizations/{organizationId}/databases/{databaseId}/restore:
post:
summary: Restore Database
description: >-
Restore a database deleted within the last five days, exactly as it was
at the moment it was deleted. Requires a paid plan, an admin or owner of
the organization, and recovery enabled for the organization.
operationId: restoreDatabase
parameters:
- $ref: '#/components/parameters/organizationId'
- $ref: '#/components/parameters/databaseId'
requestBody:
required: false
content:
application/json:
schema:
type: object
properties:
name:
type: string
description: >-
Optional new name for the restored database. If omitted, the
original name is reused. The hostname is re-derived from the
name.
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
database:
$ref: '#/components/schemas/DeletedDatabase'
description: The restored database.
'400':
description: >-
Recovery is disabled for the organization, or the request is
invalid.
'403':
description: >-
The organization is on the free plan, or the caller is not an admin
or owner.
'404':
description: >-
No deleted database with this UUID exists, or its recovery window
has passed.
components:
parameters:
organizationId:
name: organizationId
in: path
required: true
schema:
type: string
format: uuid
description: >-
The UUID of the organization. Retrieve it with the Retrieve Organization
endpoint (the `id` field).
databaseId:
name: databaseId
in: path
required: true
schema:
type: string
format: uuid
description: >-
The UUID of the database, as returned when listing deleted databases
(the `DbId` field).
schemas:
DeletedDatabase:
type: object
properties:
Name:
type: string
description: The database name.
DbId:
type: string
format: uuid
description: The database UUID. Use it to restore the database.
Hostname:
type: string
description: >-
The DNS hostname the database had, used for client and HTTP
connections.
group:
type: string
description: The name of the group the database belonged to.
group_id:
type: string
format: uuid
description: The UUID of the group the database belonged to.
organization_id:
type: string
format: uuid
description: The UUID of the organization.
regions:
type: array
items:
type: string
description: The regions the database was located in.
primaryRegion:
type: string
description: The primary region of the database.
delete_protection:
type: boolean
description: Whether delete protection was enabled for the database.
deleted_at:
type: string
format: date-time
description: When the database was deleted.
group_deleted_at:
type: string
format: date-time
description: >-
Set when the database's group was deleted with it. Restoring the
database also restores the group.
Synchronisiert aus der offiziellen Turso-Dokumentation (
tursodatabase/turso-docs
· MIT-Lizenz)
Offizielle Doku ↗