Get what's in stock on a cloud
/v1/clouds/{cloud}/availability Says which plans can be created in each region of a cloud right now, so you can choose a region and plan that won't be refused as sold out.
regions maps each region's id to the ids of the plans in stock there. It is null when the cloud doesn't report its stock: then any plan it lists can be ordered, and the order is still checked when it's placed. The answer can be a few minutes old. Only plans open to your account are listed.
This asks the cloud, so it counts as a heavy request. A cloud that isn't open to your account, or that doesn't exist, answers 404 not_found.
Scopes
Any valid token can make this request.
Path parameters
| Field | Type and description |
|---|---|
cloud Required | string A cloud's id, as One of: |
Example request
curl "https://api.rabbitflare.com/v1/clouds/digitalocean/availability" \
-H "Authorization: Bearer $RABBITFLARE_TOKEN" const res = await fetch("https://api.rabbitflare.com/v1/clouds/digitalocean/availability", {
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.catalog.availability.get({ cloud: "digitalocean" });
console.log(data); <?php
$ch = curl_init('https://api.rabbitflare.com/v1/clouds/digitalocean/availability');
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/clouds/digitalocean/availability",
headers={
"Authorization": "Bearer " + os.environ["RABBITFLARE_TOKEN"],
},
timeout=120,
)
response.raise_for_status()
print(response.json()["data"]) Response
200 OK Returns the Availability object in data.
The Availability object's fields 2 fields
| Field | Type and description |
|---|---|
cloud | string The cloud this is for. Known values: |
regions | object or null Each region's id, with the ids of the plans that can be created there now (an empty list: none). Null when the cloud doesn't report its stock: then any plan it lists can be ordered, and the order is still checked when it's placed. |
Example response
{
"data": {
"cloud": "digitalocean",
"regions": {
"fra1": [
"starter",
"standard",
"business"
],
"nyc3": [
"standard",
"business"
],
"lon1": []
}
}
} 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 |
|---|---|
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. |