Update or Delete Rule
Update — omit _METHOD or do not send it; the full rule options object is sent as the body and the rule is updated in place.
Delete — include "_METHOD": "DELETE" as the only body field. The rule identified by ruleId is permanently removed.
curl -X POST "https://api.5centscdn.com/v2/zones/vod/pull/12345/rules/rule/201" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"name": "Cache Segments",
"rule": "/stream/*",
"options": {
"edge_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"cors": {
"enabled": null,
"control": "*",
"always": false,
"value": "*",
"custom": ""
}
}
}'
import requests
import json
url = "https://api.5centscdn.com/v2/zones/vod/pull/12345/rules/rule/201"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
data = {
"name": "Cache Segments",
"rule": "/stream/*",
"options": {
"edge_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"cors": {
"enabled": null,
"control": "*",
"always": false,
"value": "*",
"custom": ""
}
}
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.5centscdn.com/v2/zones/vod/pull/12345/rules/rule/201", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"name": "Cache Segments",
"rule": "/stream/*",
"options": {
"edge_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"cors": {
"enabled": null,
"control": "*",
"always": false,
"value": "*",
"custom": ""
}
}
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"name": "Cache Segments",
"rule": "/stream/*",
"options": {
"edge_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"cors": {
"enabled": null,
"control": "*",
"always": false,
"value": "*",
"custom": ""
}
}
}`)
req, err := http.NewRequest("POST", "https://api.5centscdn.com/v2/zones/vod/pull/12345/rules/rule/201", bytes.NewBuffer(data))
if err != nil {
panic(err)
}
req.Header.Set("Content-Type", "application/json")
req.Header.Set("X-API-Key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
fmt.Println("Response Status:", resp.Status)
}
require 'net/http'
require 'json'
uri = URI('https://api.5centscdn.com/v2/zones/vod/pull/12345/rules/rule/201')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Content-Type'] = 'application/json'
request['X-API-Key'] = 'YOUR_API_KEY'
request.body = '{
"name": "Cache Segments",
"rule": "/stream/*",
"options": {
"edge_cache_settings": {
"enabled": null,
"control": "default",
"default": "345600s",
"value": "345600s",
"revalidate": null,
"custom": {
"default": "",
"value": ""
},
"custom_values": {
"codes": [],
"value": []
}
},
"cors": {
"enabled": null,
"control": "*",
"always": false,
"value": "*",
"custom": ""
}
}
}'
response = http.request(request)
puts response.body
{
"result": "success",
"message": "Zone EdgeRule Updated. Please wait till the rules validation & deployment completes."
}
{
"result": "success",
"message": "Zone EdgeRule Deleted. Please wait till the deployment completes."
}
{
"error": "Bad Request",
"message": "The request contains invalid parameters or malformed data",
"code": 400,
"details": [
{
"field": "email",
"message": "Invalid email format"
}
]
}
{
"error": "Unauthorized",
"message": "Authentication required. Please provide a valid API token",
"code": 401
}
/zones/vod/pull/{zoneId}/rules/rule/{ruleId}Target server for requests. Edit to use your own host.
API key (sent in header)
Numeric ID of the zone
Numeric ID of the edge rule to update or delete
The media type of the request body
Pre-populated rule name. Send back as received from GET rules.
Pre-populated rule pattern. Send back as received from GET rules.
Full options object for the rule update.
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Provide your API key in the header.
Path Parameters
Body
Pre-populated rule name. Send back as received from GET rules.
Cache SegmentsPre-populated rule pattern. Send back as received from GET rules.
/stream/*Full options object for the rule update.
CDN edge cache TTL configuration.
nulldefaultvalueno-cache345600s345600snull[][]CDN midgress cache TTL configuration.
nulldefaultvalue345600s345600snull[][]Browser-side Cache-Control TTL configuration.
nulldefaultno-cachecustom345600sStrip query string from cache key. Mutually exclusive with query_params_blacklist/whitelist.
Strip listed query params from cache key.
nullnullKeep only listed query params in cache key.
nullnullAllow or block requests by country.
nullallowdeny[][]Allow or block requests by IP address.
nullallowdeny[][]Allow or block requests by User-Agent header.
nullallowdeny[][]falseAllow or block requests by Referer header.
nullallowdenyfalse[][]Signed URL token authentication.
null0[]falsePer-connection download speed throttling.
nullstaticdynamic120001024Per-IP request rate limiting.
null99896[]Nginx-style URL rewrite rule.
Redirect requests to a different hostname.
Permanently redirect HTTP requests to HTTPS (301).
nullFollow HTTP redirects returned by the origin.
null[]HTTP Strict Transport Security configuration.
nullno-referrerno-referrer-when-downgradeoriginorigin-when-cross-originsame-originstrict-originstrict-origin-when-cross-originunsafe-urltruetrueAdd X-Forwarded-For header to origin requests.
nullSNI hostname for TLS handshake toward origin.
Return a fixed HTTP status code for matched requests.
Serve stale cached content if origin is unreachable.
nullAdd or override response headers.
Add or override request headers forwarded to origin.
Suppress specific response headers before delivery to client.
Control the Host header sent to origin.
Legacy alias for hostHeader. Send alongside hostHeader.
nullCORS header support.
null*false*Responses
Status of the API response.
successerrorerror