Forum Discussion
iControlREST and Curl to save and download ASM policies
Hello Saidshow,
For any export/import on ASM, you need to use its /tasks endpoint, and file transfer endpoint afterwards.
In your case it is:
/mgmt/tm/asm/tasks/export-policy
/mgmt/tm/asm/file-transfer/downloads
NOTE: This is not possible in 11.5.4 as file_transfer endpoint for ASM was added in 11.6.x. You can attempt to use another endpoint for file transfer (see: this article )
If you are familiar with python, using this library would be your best choice:
https://github.com/F5Networks/f5-common-python
Please have a look at the functional and unit tests as they should give you idea how to use it.
If you really want to use CURL, then I guess something like this should work:
1. Export to a file
curl -v -sk -u admin:admin https://myF5/mgmt/tm/asm/tasks/export-policy -H 'Content-Type: application/json' -X POST -d '{"filename":"as_test.xml","policyReference":"{"link": "https://localhost/mgmt/tm/asm/policies/yutqTnGiAizDLpdd_mkRvg"}"}'
- Policy link above would have to correspond to selfLink property of your intended exported policy.
2. Download the file
curl -v -sk -u admin:admin https://myF5/mgmt/tm/asm/file-transfer/downloads/as_test.xml -H 'Content-Type': 'application/octet-stream' -X GET
I hope this helps
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