Forum Discussion
frapes_247370
Feb 12, 2016Nimbostratus
API RESTful - Creation a new rule by curl
Hi people, i'm trying to create a rule and define it, by API restful v11.5.3 with this sintax:
curl -k -u admin:pass-H "Content-Type: application/json" -X POST https://IP/mgmt/tm/ltm/rule -d '...
- Feb 12, 2016
There are two problems. Firstly, you have double-quotes in the rule definition that aren't escaped. The shell will divide arguments on those quotes. Secondly, there is a syntax error. The use pool ... command should be simply pool .... The following works:
curl -k -u 'admin:pass' -H "Content-Type: application/json" \ -X POST https://host/mgmt/tm/ltm/rule -d \ '{ "name" : "RuleUpload", "apiAnonymous" : "when HTTP_REQUEST { if { [HTTP::uri] starts_with \"/portalCiccio\" } { pool dinonnapapera } elseif { [HTTP::uri] starts_with \"/scriptCiccio\" } { pool dinonnapapera } else { TCP::close } }" }'
VernonWells
Feb 12, 2016Employee
There are two problems. Firstly, you have double-quotes in the rule definition that aren't escaped. The shell will divide arguments on those quotes. Secondly, there is a syntax error. The use pool ... command should be simply pool .... The following works:
curl -k -u 'admin:pass' -H "Content-Type: application/json" \
-X POST https://host/mgmt/tm/ltm/rule -d \
'{ "name" : "RuleUpload", "apiAnonymous" : "when HTTP_REQUEST { if { [HTTP::uri] starts_with \"/portalCiccio\" } { pool dinonnapapera } elseif { [HTTP::uri] starts_with \"/scriptCiccio\" } { pool dinonnapapera } else { TCP::close } }" }'
- frapes_247370May 11, 2017Nimbostratus
thanks
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects