Forum Discussion
martijnbrands_3
Nimbostratus
Oct 15, 2018PATCH IRule REST API in transaction not executed
Hello,
When I do a PATCH request to edit an IRule in an Transaction then the change is not executed. When I do a PATCH request without a transaction the change is executed. I do the change togethe...
Kevin_Stewart
Employee
Oct 15, 2018Try this:
!/bin/bash
USERPASS='admin:admin'
create a transaction and return the transaction ID
transid=`curl -sk -u $USERPASS -H 'Accept: application/json' -H 'Content-Type: application/json' https://localhost/mgmt/tm/transaction -d '{}' |awk -F"," '{ print $1 }' |awk -F":" '{ print $2 }'`
modify the iRule
curl -sk -u $USERPASS -H "X-F5-REST-Coordination-Id: $transid" -H "Accept: application/json" -H "Content-Type: application/json" -X PATCH https://localhost/mgmt/tm/ltm/rule/~Common~test1-rule -d@irule.txt
modify persistence
curl -sk -u $USERPASS -H "X-F5-REST-Coordination-Id: $transid" -H "Accept: application/json" -H 'Content-Type: application/json' -X PATCH -d '{"persist":[{"name":"cookie"}]}' https://localhost/mgmt/tm/ltm/virtual/webserver-vip
commit the transaction
curl -sk -u $USERPASS -H "Accept: application/json" -H "Content-Type: application/json" -X PUT https://localhost/mgmt/tm/transaction/$transid -d '{ "state":"VALIDATING" }'
where irule.txt is your iRule payload.
{
"apiAnonymous":" this is a test\n
when HTTP_REQUEST {\n
log local0. \"Hello World\"\n
}"
}
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