Update a redirect rule
const url = 'https://dashboard.quantcdn.io/api/v2/organizations/example/projects/example/rules/redirect/example';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"domain":["test-domain.com","*.test-domain.com"],"name":"Test redirect rule","uuid":"123e4567-e89b-12d3-a456-426614174000","weight":0,"disabled":false,"url":["/old-path/*","/legacy/*"],"country":"country_is","country_is":["US","CA","GB"],"country_is_not":["CN","RU"],"method":"method_is","method_is":["GET","POST"],"method_is_not":["DELETE","PUT"],"ip":"ip_is","ip_is":["192.168.1.0/24","10.0.0.1"],"ip_is_not":["172.16.0.0/12"],"asn":"any","asn_is":["15169","8075"],"asn_is_not":["13335"],"redirect_to":"https://test-domain.com/new-path","redirect_code":"301"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://dashboard.quantcdn.io/api/v2/organizations/example/projects/example/rules/redirect/example \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "domain": [ "test-domain.com", "*.test-domain.com" ], "name": "Test redirect rule", "uuid": "123e4567-e89b-12d3-a456-426614174000", "weight": 0, "disabled": false, "url": [ "/old-path/*", "/legacy/*" ], "country": "country_is", "country_is": [ "US", "CA", "GB" ], "country_is_not": [ "CN", "RU" ], "method": "method_is", "method_is": [ "GET", "POST" ], "method_is_not": [ "DELETE", "PUT" ], "ip": "ip_is", "ip_is": [ "192.168.1.0/24", "10.0.0.1" ], "ip_is_not": [ "172.16.0.0/12" ], "asn": "any", "asn_is": [ "15169", "8075" ], "asn_is_not": [ "13335" ], "redirect_to": "https://test-domain.com/new-path", "redirect_code": "301" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”object
Domain patterns (default: any)
Example
[ "test-domain.com", "*.test-domain.com"]Rule name
Example
Test redirect ruleRule UUID
Example
123e4567-e89b-12d3-a456-426614174000Rule weight
Example
100Whether rule is disabled
Example
falseURL patterns
Example
[ "/old-path/*", "/legacy/*"]Country filter type (country_is, country_is_not, any)
Example
country_isAllowed countries
Example
[ "US", "CA", "GB"]Excluded countries
Example
[ "CN", "RU"]Method filter type (method_is, method_is_not, any)
Example
method_isAllowed HTTP methods
Example
[ "GET", "POST"]Excluded HTTP methods
Example
[ "DELETE", "PUT"]IP filter type (ip_is, ip_is_not, any)
Example
ip_isAllowed IP addresses
Example
[ "192.168.1.0/24", "10.0.0.1"]Excluded IP addresses
Example
[ "172.16.0.0/12"]ASN filter type (asn_is, asn_is_not, any)
Example
anyAllowed AS numbers
Example
[ "15169", "8075"]Excluded AS numbers
Example
[ "13335"]Redirect destination URL
Example
https://test-domain.com/new-pathHTTP status code for redirect
Example
301Responses
Section titled “Responses”The request has succeeded.
object
Rule name
Rule UUID
Rule ID
Rule weight
URL patterns
Domain patterns
Whether rule is disabled
Only apply with cookie
HTTP method
Allowed HTTP methods
Excluded HTTP methods
IP address
Allowed IP addresses
Excluded IP addresses
ASN filter type (asn_is, asn_is_not, any)
Allowed AS numbers
Excluded AS numbers
Country code
Allowed countries
Excluded countries
Rule action
object
Redirect destination URL
HTTP status code for redirect
Example
{ "name": "Test redirect rule", "uuid": "123e4567-e89b-12d3-a456-426614174000", "rule_id": "rule-001", "weight": 0, "url": [ "/old-path/*", "/legacy/*" ], "domain": [ "test-domain.com", "*.test-domain.com" ], "disabled": false, "only_with_cookie": "session_id", "method": "GET", "method_is": [ "GET", "POST" ], "method_is_not": [ "DELETE", "PUT" ], "ip": "192.168.1.1", "ip_is": [ "192.168.1.0/24", "10.0.0.1" ], "ip_is_not": [ "172.16.0.0/12" ], "asn": "any", "asn_is": [ "15169", "8075" ], "asn_is_not": [ "13335" ], "country": "US", "country_is": [ "US", "CA", "GB" ], "country_is_not": [ "CN", "RU" ], "action": "redirect", "action_config": { "to": "https://test-domain.com/new-path", "status_code": "301" }}The server could not understand the request due to invalid syntax.
object
Error message
Error flag
Example
{ "message": "The requested resource was not found", "error": true}Access is forbidden.
object
Error message
Error flag
Example
{ "message": "The requested resource was not found", "error": true}