Turso Cloud API 参考 接口资源 数据库
恢复数据库
恢复在过去五天内删除的数据库,使其完全恢复到删除时的状态。需要付费套餐、组织管理员或所有者,并为组织启用恢复功能。
POST
https://api.turso.tech/v3/organizations/{organizationId}/databases/{databaseId}/restore 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.
同步自官方 Turso 文档仓库 (
tursodatabase/turso-docs
· MIT 开源协议)
查看官方原文 ↗