Turso Cloud API 參考 介面資源 資料庫
還原資料庫
還原過去五天內刪除的資料庫,使其完全恢復為刪除當下的狀態。需要付費方案、組織的管理員或擁有者身分,且組織已啟用復原功能。
POST
https://api.turso.tech/v3/organizations/{organizationId}/databases/{databaseId}/restore 注意
與 v1 端點不同,此端點以 UUID 識別組織與資料庫 —— 請使用
Retrieve Organization 回傳的 id 欄位,
以及 List Deleted Databases 回傳的 DbId
欄位。
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 的平台 API
security: []
paths:
/v3/organizations/{organizationId}/databases/{databaseId}/restore:
post:
summary: 還原資料庫
description: >-
還原過去五天內刪除的資料庫,使其完全恢復為刪除當下的狀態。需要付費方案、
組織的管理員或擁有者身分,且組織已啟用復原功能。
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: >-
還原後資料庫的選用新名稱。若省略,則沿用原始名稱。主機名稱會根據
此名稱重新推導。
responses:
'200':
description: 成功回應
content:
application/json:
schema:
type: object
properties:
database:
$ref: '#/components/schemas/DeletedDatabase'
description: 已還原的資料庫。
'400':
description: >-
組織已停用復原功能,或請求無效。
'403':
description: >-
組織使用免費方案,或呼叫者並非管理員或擁有者。
'404':
description: >-
不存在具有此 UUID 的已刪除資料庫,或其復原時限已過。
components:
parameters:
organizationId:
name: organizationId
in: path
required: true
schema:
type: string
format: uuid
description: >-
組織的 UUID。可透過 Retrieve Organization 端點取得(`id` 欄位)。
databaseId:
name: databaseId
in: path
required: true
schema:
type: string
format: uuid
description: >-
資料庫的 UUID,即列出已刪除資料庫時所回傳的值(`DbId` 欄位)。
schemas:
DeletedDatabase:
type: object
properties:
Name:
type: string
description: 資料庫名稱。
DbId:
type: string
format: uuid
description: 資料庫 UUID。可用於還原該資料庫。
Hostname:
type: string
description: >-
資料庫原有的 DNS 主機名稱,用於用戶端與 HTTP 連線。
group:
type: string
description: 該資料庫所屬群組的名稱。
group_id:
type: string
format: uuid
description: 該資料庫所屬群組的 UUID。
organization_id:
type: string
format: uuid
description: 組織的 UUID。
regions:
type: array
items:
type: string
description: 該資料庫所在的區域。
primaryRegion:
type: string
description: 該資料庫的主要區域。
delete_protection:
type: boolean
description: 該資料庫是否已啟用刪除保護。
deleted_at:
type: string
format: date-time
description: 資料庫的刪除時間。
group_deleted_at:
type: string
format: date-time
description: >-
當資料庫的群組隨之一起刪除時會設定此欄位。還原該資料庫也會一併還原該群組。
同步自官方 Turso 文件倉庫 (
tursodatabase/turso-docs
· MIT 開源授權)
檢視官方原文 ↗