Check a server's room for a clone
/v1/sites/{siteId}/clone/room Asks a destination server how much room it has for a clone of the site. Give the site's size from GET /sites/{siteId}/clone (filesBytes, databaseBytes) to have the room needed worked out and fits answered. A clone to another server needs more room there, as the site is packed and downloaded first. When the server doesn't answer, unknown is true; the clone checks again before copying.
Scopes
The token needs these scopes. Without them, the request is refused with insufficient_scope (see Scopes).
-
sites:create - Create sites. Install new WordPress sites on your servers. Cloning a site also needs Manage sites.
-
sites:write - Manage sites. Domains, SSL, CDN, cache, firewall, malware protection, resources, backups, staging, Media Offload, SMTP and RabbitPress Cache. Choosing Rabbitflare Backup for a site's backups, and turning on Media Offload or a site's malware protection, also need Turn on paid features: they start monthly charges.
Path parameters
| Field | Type and description |
|---|---|
siteId Required | string The id of the site to clone. |
Query parameters
| Field | Type and description |
|---|---|
serverId Required | string The destination server's id. |
filesBytes | integer 0 to 10,995,116,277,760 The site's files in bytes ( |
databaseBytes | integer 0 to 10,995,116,277,760 The site's database in bytes ( |
Example request
curl "https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/clone/room?serverId=3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d&filesBytes=48000000&databaseBytes=6400000" \
-H "Authorization: Bearer $RABBITFLARE_TOKEN" const res = await fetch("https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/clone/room?serverId=3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d&filesBytes=48000000&databaseBytes=6400000", {
headers: {
Authorization: `Bearer ${process.env.RABBITFLARE_TOKEN}`,
},
});
if (!res.ok) throw new Error(`Rabbitflare API error ${res.status}: ${await res.text()}`);
const { data } = await res.json();
console.log(data); import { Rabbitflare } from "@rabbitflare/api";
const rf = new Rabbitflare({ token: process.env.RABBITFLARE_TOKEN });
const data = await rf.sites.clone.checkRoom({
siteId: "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
serverId: "3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d",
filesBytes: 48000000,
databaseBytes: 6400000,
});
console.log(data); <?php
$ch = curl_init('https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/clone/room?serverId=3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d&filesBytes=48000000&databaseBytes=6400000');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RABBITFLARE_TOKEN'),
],
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
if ($body === false || $status >= 400) {
throw new RuntimeException("Rabbitflare API error $status: $body");
}
print_r(json_decode($body, true)['data']); import os
import requests
response = requests.get(
"https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/clone/room",
headers={
"Authorization": "Bearer " + os.environ["RABBITFLARE_TOKEN"],
},
params={
"serverId": "3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d",
"filesBytes": "48000000",
"databaseBytes": "6400000",
},
timeout=120,
)
response.raise_for_status()
print(response.json()["data"]) Response
200 OK Returns the CloneRoom object in data.
The CloneRoom object's fields 5 fields
| Field | Type and description |
|---|---|
serverId | string The destination server's id. |
freeBytes | integer or null Free room on the server's disk. Null when it couldn't be checked. |
neededBytes | integer The room the clone needs there while it's made, with what must stay free (0 when the site's size wasn't given). |
fits | boolean or null Whether the clone fits. Null when that couldn't be checked; the clone checks again before copying. |
unknown | boolean Whether the room couldn't be checked (the server didn't answer). |
Example response
{
"data": {
"serverId": "3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d",
"freeBytes": 41871163392,
"neededBytes": 330825728,
"fits": true,
"unknown": false
}
} Errors
The errors this request can answer besides those every request can (a missing token, a missing scope, the rate limits). Each answer is an Error object (see Errors).
| Status and code | When, and what to do |
|---|---|
400 invalid_ | A query parameter is unknown or has a wrong value ( Correct or remove the parameter named in |
403 trial_ | The site's server is on the free trial: WordPress sign-in, the File Manager and Cron Jobs switch on once it's kept. Keep the server in the control panel: they switch on by themselves. |
404 not_ | The resource doesn't exist, or isn't this account's. Check the id. Ids of other accounts' resources answer the same way. |
409 server_ | The server is being restored, and nothing else can change it or its sites until that's done. Wait until the restore finishes (the server's |