Add an edge WAF rule to a project
import requests
url = "https://platform.ankra.app/api/v1/org/projects/{project_id}/waf/rules"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://platform.ankra.app/api/v1/org/projects/{project_id}/waf/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/projects/{project_id}/waf/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"rule": {
"id": "<string>",
"zone_id": "<string>",
"set_at_zone": "<string>",
"project_id": "<string>",
"hostname": "<string>",
"description": "<string>",
"action": "block",
"path_prefix": "<string>",
"methods": [
"<string>"
],
"sources": [
"<string>"
],
"rule_ids": [
123
],
"enabled": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}DNS
Add an edge WAF rule to a project
Adds a block, allow or skip_rules rule for every hostname of the project’s zones, or one hostname. An allow rule that matches every request it covers is refused. Requires an organisation admin; Ankra Cloud checks the project is one the organisation lists and audits the change.
POST
/
api
/
v1
/
org
/
projects
/
{project_id}
/
waf
/
rules
Add an edge WAF rule to a project
import requests
url = "https://platform.ankra.app/api/v1/org/projects/{project_id}/waf/rules"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://platform.ankra.app/api/v1/org/projects/{project_id}/waf/rules', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://platform.ankra.app/api/v1/org/projects/{project_id}/waf/rules \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"rule": {
"id": "<string>",
"zone_id": "<string>",
"set_at_zone": "<string>",
"project_id": "<string>",
"hostname": "<string>",
"description": "<string>",
"action": "block",
"path_prefix": "<string>",
"methods": [
"<string>"
],
"sources": [
"<string>"
],
"rule_ids": [
123
],
"enabled": true,
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
}Authorizations
Body
application/json
A customer WAF rule. block answers 403 in every mode; allow forwards without inspection; skip_rules leaves Core Rule Set rules 911000-944999 out. A matching block wins, then allow; skipped rules of every match combine. block and allow need a path_prefix, methods or sources.