Replace delivery rule
Requires Modify distribution. Up to five rules per distribution. Brotli overrides require Origin Shield. Updates replace rule settings.
PUT
/
cloud-cdn
/
distributions
/
rules
Replace delivery rule
curl --request PUT \
--url https://api.aptranet.com/cloud-cdn/distributions/rules \
--header 'Aptranet-Secret: <api-key>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"pattern": "<string>"
}
'import requests
url = "https://api.aptranet.com/cloud-cdn/distributions/rules"
payload = {
"name": "<string>",
"pattern": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Aptranet-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
Authorization: 'Bearer <token>',
'Aptranet-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({name: '<string>', pattern: '<string>'})
};
fetch('https://api.aptranet.com/cloud-cdn/distributions/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aptranet.com/cloud-cdn/distributions/rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"pattern\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Aptranet-Secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"name": "<string>",
"pattern": "<string>",
"weight": 1,
"active": true,
"origin_protocol": "",
"options": {
"allowedHttpMethods": {},
"brotli_compression": {},
"browser_cache_settings": {},
"cors": {},
"country_acl": {},
"disable_proxy_force_ranges": {},
"edge_cache_settings": {},
"fetch_compressed": {},
"follow_origin_redirect": {},
"force_return": {},
"forward_host_header": {},
"gzipOn": {},
"hostHeader": {},
"ignore_cookie": {},
"ignoreQueryString": {},
"image_stack": {},
"ip_address_acl": {},
"limit_bandwidth": {},
"proxy_cache_key": {},
"proxy_cache_methods_set": {},
"proxy_connect_timeout": {},
"proxy_read_timeout": {},
"query_params_blacklist": {},
"query_params_whitelist": {},
"query_string_forwarding": {},
"redirect_http_to_https": {},
"redirect_https_to_http": {},
"referrer_acl": {},
"response_headers_hiding_policy": {},
"rewrite": {},
"secure_key": {},
"slice": {},
"sni": {},
"stale": {},
"static_response_headers": {},
"staticHeaders": {},
"staticRequestHeaders": {},
"user_agent_acl": {},
"websockets": {}
},
"id": 2,
"rule_type": 123
}{
"error": "<string>",
"error_description": "<string>"
}Authorizations
Project API access key.
Current secret for the access key.
Query Parameters
Required range:
x >= 1Required range:
x >= 1Body
application/json
Maximum string length:
255Path or expression starting with / or ^/. No hostname or whitespace.
Maximum string length:
300Required range:
0 <= x <= 100000Available options:
, INHERIT, HTTP, HTTPS, MATCH Show child attributes
Show child attributes
Response
Successful response.
Maximum string length:
255Path or expression starting with / or ^/. No hostname or whitespace.
Maximum string length:
300Required range:
0 <= x <= 100000Available options:
, INHERIT, HTTP, HTTPS, MATCH Show child attributes
Show child attributes
Required range:
x >= 1Replace delivery rule
curl --request PUT \
--url https://api.aptranet.com/cloud-cdn/distributions/rules \
--header 'Aptranet-Secret: <api-key>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"pattern": "<string>"
}
'import requests
url = "https://api.aptranet.com/cloud-cdn/distributions/rules"
payload = {
"name": "<string>",
"pattern": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Aptranet-Secret": "<api-key>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {
Authorization: 'Bearer <token>',
'Aptranet-Secret': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({name: '<string>', pattern: '<string>'})
};
fetch('https://api.aptranet.com/cloud-cdn/distributions/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.aptranet.com/cloud-cdn/distributions/rules"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"pattern\": \"<string>\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Aptranet-Secret", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"name": "<string>",
"pattern": "<string>",
"weight": 1,
"active": true,
"origin_protocol": "",
"options": {
"allowedHttpMethods": {},
"brotli_compression": {},
"browser_cache_settings": {},
"cors": {},
"country_acl": {},
"disable_proxy_force_ranges": {},
"edge_cache_settings": {},
"fetch_compressed": {},
"follow_origin_redirect": {},
"force_return": {},
"forward_host_header": {},
"gzipOn": {},
"hostHeader": {},
"ignore_cookie": {},
"ignoreQueryString": {},
"image_stack": {},
"ip_address_acl": {},
"limit_bandwidth": {},
"proxy_cache_key": {},
"proxy_cache_methods_set": {},
"proxy_connect_timeout": {},
"proxy_read_timeout": {},
"query_params_blacklist": {},
"query_params_whitelist": {},
"query_string_forwarding": {},
"redirect_http_to_https": {},
"redirect_https_to_http": {},
"referrer_acl": {},
"response_headers_hiding_policy": {},
"rewrite": {},
"secure_key": {},
"slice": {},
"sni": {},
"stale": {},
"static_response_headers": {},
"staticHeaders": {},
"staticRequestHeaders": {},
"user_agent_acl": {},
"websockets": {}
},
"id": 2,
"rule_type": 123
}{
"error": "<string>",
"error_description": "<string>"
}