Demystifying iControl REST Part 5: Transferring Files
iControl REST. It’s iControl SOAP’s baby, brother, introduced back in TMOS version 11.4 as an early access feature but released fully in version 11.5.
Several articles on basic usage have been wri...
Updated Aug 04, 2023
Version 5.0JRahm
Admin
Christ Follower, Husband, Father, Technologist. I love community and I especially love THIS community. My background is networking, but I've dabbled in all the F5 iStuff, I'm a recovering Perl guy, and am very much a python enthusiast. Learning alongside all of you in this accelerating industry toward modern apps and architectures.F5_Digger_13600
Cirrus
Jan 03, 2018@Jason
I tried it out and got an error
For the simple test, I placed a key file under/var/config/rest/downloads/mynew_key.key and then made the following call from Windows IDLE(3.6.2):
from f5.bigip import ManagementRoot
import requests
import sys
import os
requests.packages.urllib3.disable_warnings()
mr = ManagementRoot('x.x.x.x', 'admin', 'admin')
key = mr.tm.sys.file.ssl_keys.ssl_key.create(name='MyNewkey', partition='Common', sourcePath='/var/config/rest/downloads/mynew_key.key')
Then I got the following error.
Traceback (most recent call last):
File "C:\Users\xyz\Documents\Python Practice\ssl cert key file upload.py", line 23, in
key = mr.tm.sys.file.ssl_keys.ssl_key.create(name='MyNewkey', partition='Common', sourcePath='/var/config/rest/downloads/mynew_key.key')
File "C:\Users\xyz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\f5\bigip\resource.py", line 974, in create
return self._create(**kwargs)
File "C:\Users\xyz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\f5\bigip\resource.py", line 941, in _create
response = session.post(_create_uri, json=kwargs, **requests_params)
File "C:\Users\xyz\AppData\Local\Programs\Python\Python36-32\lib\site-packages\icontrol\session.py", line 272, in wrapper
raise iControlUnexpectedHTTPError(error_message, response=response)
icontrol.exceptions.iControlUnexpectedHTTPError: 400 Unexpected Error: Bad Request for uri: https://x.x.x.x:443/mgmt/tm/sys/file/ssl-key/
Text: '{"code":400,"message":"Failed! exit_code (3).\\n","errorStack":[],"apiError":26214401}'
any idea?