Get the configuration file rules (pbx)
/configuration-import/rules
Returns the rules a configuration file from another system (kind external) must follow.
Read them before you write a converter, and again when they change.
The answer is a JSON Schema for the file and for each kind of record, so any JSON Schema validator can check
a file before you send it (version 2020-12 of the standard, named in $schema). It adds these parts:
x-cockpit-rules: the rules a JSON Schema cannot express, for example that a schedule step needs both times unless it is a specific period.x-cockpit-references: which column points at which kind of record.x-cockpit-error-codes: every error code the check can answer, with its meaning.$defs.call_flow_step.x-cockpit-options: theoptionskeys of each call flow step type.x-cockpit-pbx-features: whether voicemail, language variants and call recording are on for the PBX of your API key, because some rules depend on them. Nothing else about the PBX is returned. The copy inapi-guides/configuration-import/rules.jsonhas no such part.
A column whose meaning is not obvious from its name has a description.
Caching. The answer has an ETag and Cache-Control: private, max-age=3600. The tag changes when the
rules or the PBX's features change. Send it back in If-None-Match to get 304 while nothing changed.
Needs the configuration-import scope. Rate limit: 30 requests per minute per PBX (429 with
Retry-After). Answers 503 while configuration versions are switched off.
API key created on the Cockpit Integrations page (an "API key" integration).
It is a bearer token owned by the customer's PBX and limited to the scopes
selected when the key was created (e.g. phone-numbers, push-configuration).
Send it in the Authorization header:
Authorization: Bearer <api_key>
Manage keys (create / reveal / revoke) from Integrations → New integration → API key.
- HTTP Authorization Scheme
bearer
application/jsonResponses
https://cockpit.voxbi.com/api/v1/configuration-import/rules
curl -X GET 'https://cockpit.voxbi.com/api/v1/configuration-import/rules' \
-H 'Authorization: Bearer YOUR_TOKEN'
const response = await fetch('https://cockpit.voxbi.com/api/v1/configuration-import/rules', {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${YOUR_TOKEN}`,
},
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://cockpit.voxbi.com/api/v1/configuration-import/rules',
headers={'Authorization': f'Bearer {YOUR_TOKEN}'}
)
response.raise_for_status()
data = response.json()
print(data)
<?php
$context = stream_context_create([
'http' => [
'method' => 'GET',
'header' => "Content-Type: application/json\r\nAuthorization: Bearer YOUR_TOKEN",
],
]);
$response = file_get_contents('https://cockpit.voxbi.com/api/v1/configuration-import/rules', false, $context);
$data = json_decode($response, true);
print_r($data);
{ … }
"required": [ … ],
"x-cockpit-pbx-features": { … },
"x-cockpit-entities": { … },
"x-cockpit-error-codes": { … }
"5d41402abc4b2a76b9719d911017c592"max-age=3600, private"5d41402abc4b2a76b9719d911017c592"{ … }
application/json{ … }
application/json{ … }
60application/json