- API-Referenz
- Backup
- Create a Backup of a Project
Create a Backup of a Project
Request
- projectIdstringrequired
ID of the project to create a Backup for.
- descriptionstring
Description of the Backup.
- expirationTimestring (date-time)required
Time when to expire the Backup. Must be at least 7 days and no more than one year in the future.
Content-Type: application/json
{
"description": "I'm a ProjectBackup",
"expirationTime": "1985-10-26T01:21:00.000Z"
}
{
"properties": {
"description": {
"description": "Description of the Backup.",
"example": "I'm a ProjectBackup",
"type": "string"
},
"expirationTime": {
"description": "Time when to expire the Backup. Must be at least 7 days and no more than one year in the future.",
"format": "date-time",
"type": "string"
}
},
"required": [
"expirationTime"
],
"type": "object"
}
Responses
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"
}
Validation Error caused by invalid input data in the request
- type"ValidationError"required
- messagestring
- validationErrorsArray von objectrequired
- Array[
- *object
- messagestringrequired
The standard error message
- pathstringrequired
The path to the part of the data that was validated. JavaScript property access notation (e.g., ".prop[1].subProp") is used.
- typestringrequired
ajv validation error type (e.g. "format", "required", "type") or own validation error types
- contextobject
The object with the additional information about the error that can be used to create custom error messages. Keys depend on the type that failed validation (e.g. "missingProperty" for type "required")
- *string
]
Content-Type: application/json
{
"type": "ValidationError",
"message": "Validation failed",
"validationErrors": [
{
"message": "should be string",
"path": ".address.street",
"type": "format",
"context": {
"format": "email"
}
}
]
}
{
"type": "object",
"required": [
"type",
"validationErrors"
],
"properties": {
"type": {
"type": "string",
"enum": [
"ValidationError"
]
},
"message": {
"type": "string",
"example": "Validation failed"
},
"validationErrors": {
"type": "array",
"items": {
"type": "object",
"required": [
"message",
"path",
"type"
],
"properties": {
"message": {
"type": "string",
"description": "The standard error message",
"example": "should be string"
},
"path": {
"type": "string",
"description": "The path to the part of the data that was validated. JavaScript property access notation (e.g., \".prop[1].subProp\") is used.\n",
"example": ".address.street"
},
"type": {
"type": "string",
"description": "ajv validation error type (e.g. \"format\", \"required\", \"type\") or own validation error types",
"example": "format"
},
"context": {
"type": "object",
"example": {
"format": "email"
},
"description": "The object with the additional information about the error that can be used to create custom error messages. Keys depend on the\ntype that failed validation (e.g. \"missingProperty\" for type \"required\")\n",
"additionalProperties": {
"type": "string"
}
}
}
}
}
}
}
The requested resource was not found
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
Your request ran into a rate limit. You have to wait until rate limit expires
- messagestring
- typestring
Content-Type: application/json
{
"message": "too many requests",
"type": "RateLimitError"
}
{
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "too many requests"
},
"type": {
"type": "string",
"example": "RateLimitError"
}
}
}
An unexpected Error that occurred while handling the request
- messagestringrequired
- typestringrequired
Content-Type: application/json
{
"message": "Something went wrong",
"type": "InternalServerError"
}
{
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"message": {
"type": "string",
"example": "Something went wrong"
},
"type": {
"type": "string",
"example": "InternalServerError"
}
}
}
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();