Get a server's Media Offload storage
/v1/servers/{serverId}/media-offload Media Offload on a server: the storage included with it for its sites' media libraries, how much each site uses, and this month's extra storage so far. Storage beyond what's included is billed after the month ends. Servers of your own have no storage included (allowance is null).
Scopes
The token needs this scope. Without it, the request is refused with insufficient_scope (see Scopes).
-
servers:read - View servers. See servers, their graphs, snapshots, logs and security (Imunify360).
Path parameters
| Field | Type and description |
|---|---|
serverId Required | string The server's id. |
Example request
curl "https://api.rabbitflare.com/v1/servers/3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d/media-offload" \
-H "Authorization: Bearer $RABBITFLARE_TOKEN" const res = await fetch("https://api.rabbitflare.com/v1/servers/3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d/media-offload", {
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.servers.mediaOffload.get({
serverId: "3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d",
});
console.log(data); <?php
$ch = curl_init('https://api.rabbitflare.com/v1/servers/3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d/media-offload');
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/servers/3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d/media-offload",
headers={
"Authorization": "Bearer " + os.environ["RABBITFLARE_TOKEN"],
},
timeout=120,
)
response.raise_for_status()
print(response.json()["data"]) Response
200 OK Returns the ServerMediaOffload object in data.
The ServerMediaOffload object's fields 11 fields
| Field | Type and description | ||||||||
|---|---|---|---|---|---|---|---|---|---|
serverId | string The server's id. | ||||||||
allowance | object or null The server's included storage. Null on servers of your own: storage is included with the servers Rabbitflare creates. | ||||||||
includedBytes | integer Storage included with the server, shared by its sites (decimal: 1 GB is 1,000,000,000 bytes). | ||||||||
usedBytes | integer Storage the server's sites use now. | ||||||||
sites | array of objects The sites using it, largest first. Show its 3 fields
| ||||||||
extraCentsPerGbMonth | number The price of each GB stored beyond what's included, per month, in US cents (it can have decimals). Billed after the month ends. | ||||||||
monthToDateCents | integer or null Extra storage this month so far, before it's billed, in US cents. Null for a token without | ||||||||
currency | string Always Always |
Example response
{
"data": {
"serverId": "3f6c1a2b-8d4e-4b7a-9c2d-1e5f7a8b9c0d",
"allowance": {
"includedBytes": 100000000000,
"usedBytes": 12480000000,
"sites": [
{
"siteId": "8a1b2c3d-4e5f-4a6b-8c7d-9e0f1a2b3c4d",
"name": "Shop",
"bytes": 12480000000
}
],
"extraCentsPerGbMonth": 2.085,
"monthToDateCents": 0,
"currency": "usd"
}
}
} 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 |
|---|---|
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. |