REST API Examples
This article provides a few examples on how to use the Barracuda Web Application Firewall REST APIs:
In this article:
Virtual Service
Real Server
Content Rule
Rule Group Server
Logs
Certificates
Virtual Service
Example: Creating a HTTP Service
Request:
curl -X POST "http://10.36.73.160:8000/restapi/v3.2/services " -H "Content-Type: application/json" -u "eyJldCI6IiOGUxNDQ2OTM4ZjRkIn0=\n:" -d
{
"address-version": "IPv4",
"app-id": "app1",
"comments": "This is a demo service",
"ip-address": "10.36.73.154",
"mask": "255.255.255.0",
"name": "service_app1",
"port": "80",
"type": "HTTP"
}
Response:
{"id":"service_app1","token":"eyJ1c2ZXQiOiIxNjI2MDg1NDc3In0=\n","msg":"Successfully created."}
Example: Creating a HTTPS Service
Request:
curl -X POST "http://10.36.73.160:8000/restapi/v3.2/services " -H "Content-Type: application/json" -u "eyJldCkNjQzNjZiOGUxNDQ2OTM4ZjRkIn0=\n:" -d
'{
"address-version": "IPv4",
"app-id": "app1-https",
"comments": "This is a demo service",
"ip-address": "10.36.73.154",
"mask": "255.255.255.0",
"name": "service_app1_secure",
"port": "443",
"certificate": "test_cert",
"type": "HTTPS"
}'
Response:
{"id":"service_app1_secure","token":"eyJldCNlciI6ImFkbWluIn0=\n","msg":"Successfully created."}