Networking
Toggle CDN
Toggle CDN on or off for an application. If CDN is currently enabled, it will be disabled, and vice versa. Returns the new CDN status after toggling.
POST
/
applications
/
{id}
/
cdn
/
toggle
Toggle CDN
curl --request POST \
--url https://api.sevalla.com/v3/applications/{id}/cdn/toggle \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sevalla.com/v3/applications/{id}/cdn/toggle"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sevalla.com/v3/applications/{id}/cdn/toggle', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sevalla.com/v3/applications/{id}/cdn/toggle",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sevalla.com/v3/applications/{id}/cdn/toggle"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sevalla.com/v3/applications/{id}/cdn/toggle")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sevalla.com/v3/applications/{id}/cdn/toggle")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"is_turned_on": true
}{
"message": "Unauthorized",
"status": 401,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Forbidden",
"status": 403,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Not found",
"status": 404,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Too many requests",
"status": 429,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Internal Server Error",
"status": 500,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}Authorizations
API key authentication. Pass your API key as a Bearer token in the Authorization header.
Path Parameters
Application identifier
Pattern:
^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$Example:
"fb5e5168-4281-4bec-94c5-0d1584e9e657"
Response
Default Response
Whether CDN is currently enabled for the application
Example:
true
Was this page helpful?
Previous
Purge edge cachePurge the edge cache for an application, removing all cached content. Use this when you need cached resources to be refreshed immediately without waiting for the cache TTL to expire.
Next
⌘I
Toggle CDN
curl --request POST \
--url https://api.sevalla.com/v3/applications/{id}/cdn/toggle \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.sevalla.com/v3/applications/{id}/cdn/toggle"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.sevalla.com/v3/applications/{id}/cdn/toggle', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.sevalla.com/v3/applications/{id}/cdn/toggle",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.sevalla.com/v3/applications/{id}/cdn/toggle"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.sevalla.com/v3/applications/{id}/cdn/toggle")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sevalla.com/v3/applications/{id}/cdn/toggle")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"is_turned_on": true
}{
"message": "Unauthorized",
"status": 401,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Forbidden",
"status": 403,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Not found",
"status": 404,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Too many requests",
"status": 429,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}{
"message": "Internal Server Error",
"status": 500,
"data": {
"code": "err-abc-123",
"message": "If you need assistance, please contact support and provide this error code."
}
}