Forum Discussion
Grant_Joy_24163
Altostratus
Sep 27, 2016Unable to Upload File Through iControl REST Interface
I am attempting to upload a file through the iControl REST interface using iControl BIG-IP v12 getting a response code 400 with a response body of:
{"remainingByteCount":0,"usedChunks":{"0":5},"to...
JRahm
Admin
Oct 12, 2016From curl, you can do that this way (note the octet/stream content-type)
Get the content length
jrahm@ubuntu:/var/tmp/le/config/certs/rahmen-empire.net$ wc -c cert.csr | awk '{print $1}'
1691
Initiate the Upload
curl -i -sk -u admin:admin -X POST
-H "Expect:"
-H "Content-Type: application/octet-stream"
-H "Content-Range: 0-1690/1691"
--data-binary "@cert.csr"
https://172.16.44.15/mgmt/shared/file-transfer/uploads/cert.csr
or if you wanted to use the f5-common-python sdk, it's pretty simple:
>>> from f5.bigip import ManagementRoot as mr
>>> import requests
>>> requests.packages.urllib3.disable_warnings()
>>> b = mr('172.16.15.201', 'admin', 'admin')
>>> b.shared.file_transfer.uploads.upload_file('/Users/rahm/test.txt')
>>> b.tm.util.bash.exec_cmd('run', utilCmdArgs='-c "cat /var/config/rest/downloads/test.txt"').commandResult
u'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