POST
/rules Create a new firewall rule
Creates a new firewall rule with the provided details.
Request Body
idintegerdestinationstringRequiredactionstringRequiredpermitdenynotestringprotocolintegerRequired146174750sourcestringorderintegerRequireddestination_portobjectmatch_typestringeqgtltneqrangematch_valuearrayrangeobjectstartintegerendintegersource_portobjectmatch_typestringeqgtltneqrangematch_valuearrayrangeobjectstartintegerendintegermatchesarrayResponse
200
400
dataobjectrule_idintegersuccessbooleanRequest
curl -X POST "https://shield.royalehosting.net/api/v2/rules" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "x-organization-id: YOUR_ORG_ID" \
-H "Content-Type: application/json" \
-d '{}'Request
const response = await fetch("https://shield.royalehosting.net/api/v2/rules", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"x-organization-id": "YOUR_ORG_ID",
"Content-Type": "application/json",
},
body: JSON.stringify({
"id": 0,
"destination": "45.90.13.24/32",
"action": "permit",
"note": "Example Rule",
"protocol": 6,
"source": "8.8.8.8/32",
"order": 18,
"destination_port": {
"match_type": "eq",
"match_value": [
0
],
"range": {
"start": 0,
"end": 0
}
},
"source_port": {
"match_type": "eq",
"match_value": [
0
],
"range": {
"start": 0,
"end": 0
}
},
"matches": [
{
"match": "ack",
"match_type": "eq",
"match_value": "string",
"range": {
"start": 0,
"end": 0
}
}
]
}),
});
const data = await response.json();Request
import requests
response = requests.post(
"https://shield.royalehosting.net/api/v2/rules",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"x-organization-id": "YOUR_ORG_ID",
}
)
print(response.json())Response
{
"data": {
"rule_id": 12243
},
"success": true
}