Install or update RabbitPress Cache on a site
/v1/sites/{siteId}/rabbitpress Installs RabbitPress Cache on the site, or updates it to the newest version, and activates it. It's included on servers Rabbitflare creates. A site on a server of your own needs one of your RabbitPress Cache licences: pass its licenseId (bought in the panel), or leave it out to keep the licence the site used before.
What happens next. The answer is 202 with busy: true: the plugin is installed on the site's server, usually within a minute or two. Poll GET /sites/{siteId}/rabbitpress until busy is false: installed and version then show it, and lastError says why if it didn't finish. If the newest version is installed already (with the same licence), nothing is done and the answer is 200.
Limits. Live sites only, not staging copies (409 site_unavailable), on a running server (409 server_unavailable); one change at a time per site (409 busy). An account installs or updates up to 20 times an hour (429 rate_limited: Retry-After says when the hour's window ends).
Scopes
The token needs this scope. Without it, the request is refused with insufficient_scope (see Scopes).
-
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.
Headers
| Field | Type and description |
|---|---|
Idempotency-Key | string 1 to 255 characters A key of your own for this request, like a UUID: letters, digits and |
Path parameters
| Field | Type and description |
|---|---|
siteId Required | string The site's id. |
Request body
JSON, with these fields. Fields that aren't listed are refused.
| Field | Type and description |
|---|---|
licenseId | string For a site on a server of your own: the licence it uses, one of your active RabbitPress Cache licences (a licence covers one website). Left out: the licence the site used before. Not needed on servers Rabbitflare creates. |
Example request
curl -X PUT "https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/rabbitpress" \
-H "Authorization: Bearer $RABBITFLARE_TOKEN" \
-H "Content-Type: application/json" \
-d '{}' const res = await fetch("https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/rabbitpress", {
method: "PUT",
headers: {
Authorization: `Bearer ${process.env.RABBITFLARE_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({}),
});
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.rabbitpress.install({ siteId: "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d" });
console.log(data); <?php
$ch = curl_init('https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/rabbitpress');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 120,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('RABBITFLARE_TOKEN'),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(new stdClass()),
]);
$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.put(
"https://api.rabbitflare.com/v1/sites/8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d/rabbitpress",
headers={
"Authorization": "Bearer " + os.environ["RABBITFLARE_TOKEN"],
},
json={},
timeout=120,
)
response.raise_for_status()
print(response.json()["data"]) Response
202 Accepted Returns the SiteRabbitPress object in data. It can also answer 200 OK.
The SiteRabbitPress object's fields 10 fields
| Field | Type and description |
|---|---|
installed | boolean Whether the plugin is installed on the site, as the site's server reports it. False too while the server is off or doesn't answer. |
version | string or null The installed version. Null when the plugin isn't installed (or the server didn't say). |
latestVersion | string or null The newest version Rabbitflare installs: installing again on a site with an older version updates it. Null when none can be installed right now. |
serving | boolean Whether the web server sends the site's cached pages itself, without PHP: the fastest way. |
notServingReason | string or null Why the web server doesn't send the site's cached pages itself (PHP serves them instead, or the plugin isn't caching yet). Null while it does, or when the server didn't say. |
busy | boolean An install, update or removal is running: usually done within a minute or two. |
licenseRequired | boolean Whether the site needs one of your RabbitPress Cache licences: sites on servers of your own do. On servers Rabbitflare creates it's included, without a licence. |
licenseId | string or null The licence the site uses, on a server of your own. Null on servers Rabbitflare creates, or before a licence was chosen for the site. |
lastError | string or null Why the last install, update or removal didn't finish. Null when it did. |
blockedReason | string or null Why RabbitPress Cache can't be installed, updated or removed on this site right now: a staging copy, a site still installing, or a server that isn't running. Null when it can. |
Example response
{
"data": {
"installed": false,
"version": null,
"latestVersion": "2.0.10",
"serving": false,
"notServingReason": "The plugin isn't installed.",
"busy": true,
"licenseRequired": false,
"licenseId": null,
"lastError": null,
"blockedReason": null
}
} 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 |
|---|---|
402 license_ | The site is on a server of your own, so RabbitPress Cache needs one of your licences there. Buy a RabbitPress Cache licence in the panel, then install again with its |
403 feature_ | This product isn't open to the account. Contact support if you'd like it opened. |
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 site_ | The site isn't in a state that allows this (for example, it's still installing). Wait until the site is active, then try again. |
409 server_ | The server isn't in a state that allows this (for example, it's off or still being set up). Start the server, or wait until it's active, then try again. |
409 busy | Another change is still in progress on this server or site, or something else under way stops this one for now (a site backup running on the server, the server's backups being moved): Wait until it finishes, then try again. A change to the server or site itself is done when its |
409 conflict | This clashes with something that exists, or is already done (for example, a domain already connected to a site). Read |
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 |
422 validation_ | One or more fields are missing or wrong. Correct the fields named in |
429 rate_ | Too many requests. Wait for Retry-After seconds, then go on more slowly. |