Forum Discussion
BIG-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.com/downloads/icontrol-rest-api-user-guide-12-1-0.pdf but this does not explain how to e.g. create a draft of a policy. The documentation seems focused on ASM.
Kind regards
Johnny
3 Replies
- Craig_C_
Nimbostratus
Here'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) - Wojciech_Wypior
Nimbostratus
Please check out: https://github.com/F5Networks/f5-common-python, as this is an F5 built python SDK for REST API.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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