Forum Discussion
Johnny_Horvi_13
Nimbostratus
Feb 28, 2017BIG-IP iControl REST 12.1.2 documentation
Hi! I was wondering if anyone could point me in direction of the documentation for the iControl REST at version 12.1.2 (or similar). I have only found this: https://cdn.f5.com/websites/devcentral.f5....
Craig_C_
Nimbostratus
Mar 17, 2017Here's how I did it in Python. I couldn't find the answer anywhere, and finally figured it out. Having to do a 'patch' and the payload is {"createDraft":"True"} is the magic.
Publishing the draft is also a little tricky. I've included a code snippet for that too.
import requests
lb_name = "f5"
username = "admin"
password = "admin"
def create_policy_draft(policy_name):
ret = requests.patch(
'https://%s/mgmt/tm/ltm/policy/%s' % (lb_name, policy_name),
json={"createDraft": True},
auth=(username, password),
verify=False
)
def add_policy_rule(draft_policy_name, rule_json):
ret = requests.post(
'https://%s/mgmt/tm/ltm/policy/~Common~Drafts~%s/rules' % (
lb_name, draft_policy_name),
json=rule_json,
auth=(username, password),
verify=False
)
def publish_policy_draft(draft_policy_name):
ret = requests.post('https://%s/mgmt/tm/ltm/policy' % lb_name,
json={"command": "publish",
"name": "Drafts/%s" % draft_policy_name},
auth=(username, password),
verify=False)Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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