Get a site's backup-file rule
Answers whether Corefinity blocks requests for database dumps left in the web root (a request for a .sql or .sql.gz file answers 404), whether the site carries the rule yet, and the file types it covers.
Path parameters
The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.
Returns
200 The rule's state.
Fields of the 200 answer
Corefinity's backup-file rule on one site.
Fields
Whether the site carries the rule now.
File endings that often hold backups and that the rule does not block.
Whether the rule is offered for the site. False while it is not, and switching it on is refused.
Whether the rule is wanted. On unless somebody switched it off.
The file endings the rule blocks.
The rule as Nginx reads it, for display.
Whether a change to the rule is still running.
True when the site's platform always blocks these files itself, so the rule cannot be switched off.
When the rule was switched off. Null while it is on. Format: date-time.
True when the last change was saved but not confirmed, so whether the site carries the rule is not known. It is applied again within a few minutes.
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | scope_required | Use a token with the scope named in scope. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | feature_off | This feature is not on for your organisation yet. |
429 | rate_limited | Wait for the seconds in Retry-After. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl https://manage.corefinity.com/api/corestack/sites/1042/nginx-rules/backup-guard \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json"use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->get('https://manage.corefinity.com/api/corestack/sites/1042/nginx-rules/backup-guard');
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/nginx-rules/backup-guard', {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
},
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.get(
"https://manage.corefinity.com/api/corestack/sites/1042/nginx-rules/backup-guard",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
)
data = res.json() if res.content else None{
"backup_guard": {
"applied": true,
"attention_extensions": [
"zip",
"tar.gz",
"tgz"
],
"available": true,
"enabled": true,
"extensions": [
"sql",
"sql.gz"
],
"lines": [
"set $cf_backup_guard_body \"\";",
"if ($uri ~* \"\\.(?:sql|sql\\.gz)$\") { return 404 $cf_backup_guard_body; }"
],
"pending": false,
"platform_enforced": false,
"switched_off_at": null,
"uncertain": false
}
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}