Validate Rule Pattern
Checks whether the supplied rule glob/pattern is syntactically valid for the given zone. Called client-side with a 500 ms debounce as the user types the rule pattern field. Returns result: "success" when the pattern is valid.
curl -X POST "https://api.5centscdn.com/v2/validate/rule" \
-H "Content-Type: application/json" \
-H "X-API-Key: YOUR_API_KEY" \
-d '{
"rule": "/images/*",
"zoneid": 12345,
"zonetype": "pull"
}'
import requests
import json
url = "https://api.5centscdn.com/v2/validate/rule"
headers = {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
}
data = {
"rule": "/images/*",
"zoneid": 12345,
"zonetype": "pull"
}
response = requests.post(url, headers=headers, json=data)
print(response.json())
const response = await fetch("https://api.5centscdn.com/v2/validate/rule", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": "YOUR_API_KEY"
},
body: JSON.stringify({
"rule": "/images/*",
"zoneid": 12345,
"zonetype": "pull"
})
});
const data = await response.json();
console.log(data);
package main
import (
"fmt"
"net/http"
"bytes"
"encoding/json"
)
func main() {
data := []byte(`{
"rule": "/images/*",
"zoneid": 12345,
"zonetype": "pull"
}`)
req, err := http.NewRequest("POST", "https://api.5centscdn.com/v2/validate/rule", 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/validate/rule')
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 = '{
"rule": "/images/*",
"zoneid": 12345,
"zonetype": "pull"
}'
response = http.request(request)
puts response.body
{
"result": "success"
}
{
"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
}
/validate/rule
Target server for requests. Edit to use your own host.
API key (sent in header)
The media type of the request body
The URL pattern or regex string to validate. Same value as the rule field in the create/update payload. Supports plain path patterns (e.g. /images/*) and regex (e.g. ^/api/v[0-9]+/).
The numeric ID of the zone this rule will belong to.
The type of the zone. Determines which pattern syntax rules apply. Must match the zone's type exactly.
Request Preview
Response
Response will appear here after sending the request
Authentication
API Key for authentication. Provide your API key in the header.
Body
The URL pattern or regex string to validate. Same value as the rule field in the create/update payload. Supports plain path patterns (e.g. /images/*) and regex (e.g. ^/api/v[0-9]+/).
/images/*The type of the zone. Determines which pattern syntax rules apply. Must match the zone's type exactly.
pullpushResponses
Status of the API response.
successerrorerror