Zum Hauptinhalt springen

Create a Backup of a Project

POST/v2/projects/{projectId}/backups
API-Version
v2
Request-Methode
POST
Operation-ID
backup-create-project-backup

Request​

  • projectIdstringrequired

    ID of the project to create a Backup for.

Responses​

Format
application/json
Beschreibung

Created

  • createdAtstring (date-time)
  • deletablebooleanrequired
  • descriptionstring
  • expiresAtstring (date-time)
  • exportobject
    • downloadURLstring (url)
    • expiresAtstring (date-time)
    • formatstringrequired
    • phasestring (einer von: Pending, Exporting, Failed, Completed, Expired)
    • sha256Checksumstring
    • withPasswordbooleanrequired
  • idstring (uuid)required
  • parentIdstring (uuid)
  • projectIdstring (uuid)required
  • requestedAtstring (date-time)required
  • restoreobject
    • databaseRestoresArray von object
      • Array[
        • *object
          • databaseBackupDumpstringrequired
          • targetDatabaseIdstring (uuid)required
        ]
    • pathRestoreobject
      • clearTargetPathbooleanrequired
      • determinedTargetPathstringrequired
      • sourcePathsArray von stringrequired
        • Array[
          • *string
          ]
      • targetRestorePathstring
    • phasestring (einer von: running, completed)required
  • restorePathobject
    • clearTargetPathbooleanrequired
    • determinedTargetPathstringrequired
    • phasestring (einer von: running, completed)required
    • sourcePathstringrequired
    • targetPathstring
  • statusstringrequired
Content-Type: application/json

{
"createdAt": "1985-10-26T01:21:00.000Z",
"deletable": true,
"description": "I'm a ProjectBackup",
"expiresAt": "1985-10-26T01:21:00.000Z",
"export": {
"downloadURL": "string",
"expiresAt": "1985-10-26T01:21:00.000Z",
"format": "tar",
"phase": "Completed",
"sha256Checksum": "string",
"withPassword": true
},
"id": "f0f86186-0a5a-45b2-aa33-502777496347",
"parentId": "f0f86186-0a5a-45b2-aa33-502777496347",
"projectId": "f0f86186-0a5a-45b2-aa33-502777496347",
"requestedAt": "1985-10-26T01:21:00.000Z",
"restore": {
"databaseRestores": [
{
"databaseBackupDump": "string",
"targetDatabaseId": "f0f86186-0a5a-45b2-aa33-502777496347"
}
],
"pathRestore": {
"clearTargetPath": true,
"determinedTargetPath": "string",
"sourcePaths": [
"string"
],
"targetRestorePath": "string"
},
"phase": "running"
},
"restorePath": {
"clearTargetPath": true,
"determinedTargetPath": "string",
"phase": "running",
"sourcePath": "string",
"targetPath": "string"
},
"status": "Completed"
}
{
"properties": {
"createdAt": {
"format": "date-time",
"type": "string"
},
"deletable": {
"type": "boolean"
},
"description": {
"example": "I'm a ProjectBackup",
"type": "string"
},
"expiresAt": {
"format": "date-time",
"type": "string"
},
"export": {
"properties": {
"downloadURL": {
"format": "url",
"type": "string"
},
"expiresAt": {
"format": "date-time",
"type": "string"
},
"format": {
"example": "tar",
"type": "string"
},
"phase": {
"enum": [
"Pending",
"Exporting",
"Failed",
"Completed",
"Expired"
],
"example": "Completed",
"type": "string"
},
"sha256Checksum": {
"type": "string"
},
"withPassword": {
"type": "boolean"
}
},
"required": [
"format",
"withPassword"
],
"type": "object"
},
"id": {
"format": "uuid",
"type": "string"
},
"parentId": {
"format": "uuid",
"type": "string"
},
"projectId": {
"format": "uuid",
"type": "string"
},
"requestedAt": {
"format": "date-time",
"type": "string"
},
"restore": {
"properties": {
"databaseRestores": {
"items": {
"properties": {
"databaseBackupDump": {
"type": "string"
},
"targetDatabaseId": {
"format": "uuid",
"type": "string"
}
},
"required": [
"databaseBackupDump",
"targetDatabaseId"
],
"type": "object"
},
"type": "array"
},
"pathRestore": {
"properties": {
"clearTargetPath": {
"default": false,
"type": "boolean"
},
"determinedTargetPath": {
"type": "string"
},
"sourcePaths": {
"items": {
"type": "string"
},
"type": "array"
},
"targetRestorePath": {
"type": "string"
}
},
"required": [
"sourcePaths",
"determinedTargetPath",
"clearTargetPath"
],
"type": "object"
},
"phase": {
"enum": [
"running",
"completed"
],
"type": "string"
}
},
"required": [
"phase"
],
"type": "object"
},
"restorePath": {
"properties": {
"clearTargetPath": {
"default": false,
"type": "boolean"
},
"determinedTargetPath": {
"type": "string"
},
"phase": {
"enum": [
"running",
"completed"
],
"type": "string"
},
"sourcePath": {
"type": "string"
},
"targetPath": {
"type": "string"
}
},
"required": [
"phase",
"sourcePath",
"determinedTargetPath",
"clearTargetPath"
],
"type": "object"
},
"status": {
"example": "Completed",
"type": "string"
}
},
"required": [
"id",
"projectId",
"status",
"deletable",
"requestedAt"
],
"type": "object"
}

Nutzungsbeispiele​

$ curl \
--fail \
--location \
-X POST \
-d '{"description":"I'm a ProjectBackup","expirationTime":"1985-10-26T01:21:00.000Z"}' \
-H "Authorization: Bearer $MITTWALD_API_TOKEN" \
-H 'Content-Type: application/json' \
https://api.mittwald.de/v2/projects/string/backups
import { MittwaldAPIV2Client } from "@mittwald/api-client";
import { assertStatus } from "@mittwald/api-client-commons";

const client = MittwaldAPIClient.newWithToken(process.env.MITTWALD_API_TOKEN);
const response = await client.backup.createProjectBackup({
"projectId": "string",
"data": {
"description": "I'm a ProjectBackup",
"expirationTime": "1985-10-26T01:21:00.000Z"
}
});

assertStatus(response, 201);

use \Mittwald\ApiClient\Generated\V2\Clients\Backup\CreateProjectBackup\CreateProjectBackupRequest;
use \Mittwald\ApiClient\Generated\V2\Clients\Backup\CreateProjectBackup\CreateProjectBackupRequestBody;

$client = MittwaldAPIClient::newWithToken(getenv('MITTWALD_API_TOKEN'));

// TODO: Please consult the properties and constructor signature of
// CreateProjectBackupRequestBody to learn how to construct a valid instance
$body = new CreateProjectBackupRequestBody(/* TODO: ... */);

$request = (new CreateProjectBackupRequest(
projectId: "string",
body: $body
));
$response = $client->backup()->createProjectBackup($request);

var_dump($response->getBody();

Auf dieser Seite