Backups
Download a project as a zip file and restore it later.
Download a backup
/v1/backups
Downloads a backup of the project as a zip file, streamed while it is read.
Parameters
-
projectuuid query required The GUID of the project.
Responses
- 200 The backup (application/zip).
- 403 The caller is not the project's owner.
- 404 The project doesn't exist.
Request
curl -X GET 'https://api.stellards.io/v1/backups?project=PROJECT_ID' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-o backup.zip
const response = await fetch("https://api.stellards.io/v1/backups?project=PROJECT_ID", {
headers: {
Authorization: "Bearer ACCESS_TOKEN",
},
});
const file = await response.blob();
import requests
response = requests.get(
"https://api.stellards.io/v1/backups?project=PROJECT_ID",
headers={"Authorization": "Bearer ACCESS_TOKEN"},
)
with open("backup.zip", "wb") as file:
file.write(response.content)
using System.Net.Http.Headers;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "ACCESS_TOKEN");
var response = await client.GetAsync("https://api.stellards.io/v1/backups?project=PROJECT_ID");
await using var file = File.Create("backup.zip");
await response.Content.CopyToAsync(file);
uses
System.Classes, System.SysUtils, System.Net.HttpClient, System.Net.URLClient;
var
Client: THTTPClient;
Response: IHTTPResponse;
Target: TFileStream;
begin
Client := THTTPClient.Create;
Target := TFileStream.Create('backup.zip', fmCreate);
try
Client.CustomHeaders['Authorization'] := 'Bearer ACCESS_TOKEN';
Response := Client.Get('https://api.stellards.io/v1/backups?project=PROJECT_ID', Target);
Writeln(Response.StatusCode);
finally
Target.Free;
Client.Free;
end;
end;
Restore a backup
/v1/backups/restore
Restores a backup into the project it was made from, replacing the project's tables, records, relations, role permissions and designer layout with the backup's. Tables and fields keep their ids; members, API keys, OAuth applications, webhooks, custom queries and procedures are kept. Send the zip file as the request body (Content-Type: application/zip).
Parameters
-
projectuuid query required The GUID of the project the backup was made from; the caller must own it.
Responses
- 200 The project and what it now holds.
- 400 The file isn't a valid backup of this project, doesn't fit the plan's limits, or the restore failed (the project is then left as it was).
- 403 The caller is not the project's owner.
- 413 The file is larger than the server accepts.
Request
curl -X POST 'https://api.stellards.io/v1/backups/restore?project=PROJECT_ID' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
-H 'Content-Type: application/zip' \
--data-binary '@backup.zip'
const response = await fetch("https://api.stellards.io/v1/backups/restore?project=PROJECT_ID", {
method: "POST",
headers: {
Authorization: "Bearer ACCESS_TOKEN",
"Content-Type": "application/zip",
},
body: backup, // the zip file as a Blob or Buffer
});
const result = await response.json();
console.log(result);
import requests
response = requests.post(
"https://api.stellards.io/v1/backups/restore?project=PROJECT_ID",
headers={"Authorization": "Bearer ACCESS_TOKEN", "Content-Type": "application/zip"},
data=open("backup.zip", "rb"),
)
print(response.json())
using System.Net.Http.Headers;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "ACCESS_TOKEN");
var body = new StreamContent(File.OpenRead("backup.zip"));
body.Headers.ContentType = new MediaTypeHeaderValue("application/zip");
var response = await client.PostAsync("https://api.stellards.io/v1/backups/restore?project=PROJECT_ID", body);
Console.WriteLine(await response.Content.ReadAsStringAsync());
uses
System.Classes, System.SysUtils, System.Net.HttpClient, System.Net.URLClient;
var
Client: THTTPClient;
Response: IHTTPResponse;
Backup: TFileStream;
begin
Client := THTTPClient.Create;
Backup := TFileStream.Create('backup.zip', fmOpenRead);
try
Client.CustomHeaders['Authorization'] := 'Bearer ACCESS_TOKEN';
Response := Client.Post('https://api.stellards.io/v1/backups/restore?project=PROJECT_ID', Backup, nil, [TNetHeader.Create('Content-Type', 'application/zip')]);
Writeln(Response.ContentAsString);
finally
Backup.Free;
Client.Free;
end;
end;
Response 200
{
"messages": [],
"isSuccess": true,
"data": {
"projectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"projectName": "Webshop",
"tables": 4,
"records": 1250,
"blobs": 12,
"relations": 3,
"roles": 2,
"warnings": []
}
}