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/http/pull/12345/rules/rule/201" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"name": "Cache Images",
"rule": "/images/*",
"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/http/pull/12345/rules/rule/201"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
data = {
"name": "Cache Images",
"rule": "/images/*",
"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/http/pull/12345/rules/rule/201", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"name": "Cache Images",
"rule": "/images/*",
"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 Images",
"rule": "/images/*",
"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/http/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/http/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 Images",
"rule": "/images/*",
"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/http/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 ImagesPre-populated rule pattern. Send back as received from GET rules.
/images/*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-cachecustom345600sHLS segmenter cache TTLs. HTTP Pull with optimize=vod/live only.
nullStrip 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[]falseEnable GZip compression.
nullFetch pre-compressed content from origin.
nullEnable Brotli compression.
nullSplit large files into slices for parallel delivery.
nullPer-connection download speed throttling.
nullstaticdynamic120001024Force Content-Disposition attachment header.
null0Per-IP request rate limiting.
null99896[]Nginx-style URL rewrite rule.
Redirect requests to a different hostname.
Permanently redirect HTTP requests to HTTPS (301).
nullRestrict HTTP methods forwarded to origin. HTTP Pull only.
nullnullFollow 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.
On-the-fly image optimization.
nullDisabledLowMediumHighDisabledEnabledDisabledEnabledtruefalseCSS/JS asset optimization.
nullfalse-1falsenullfalsenullfalsenullfalsefalsefalsenullfalsefalsenullfalsefalsenullfalsefalsefalsefalseCMS-specific caching optimizations. HTTP Pull only.
null[]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.
nullRespect Vary header from origin when building cache key.
nullCORS header support.
null*false*Responses
Status of the API response.
successerrorerror