Forum Discussion
Ashok_G_263579
Jan 11, 2018Nimbostratus
Error code 400 while downloading a file via REST API
Hello Everyone,
My GET request to the device is https://192.168.55.248/mgmt/tm/asm/file-transfer/downloads/exported_file.xml
And the error I receive is,
{
"code": 400,
"messa...
Satoshi_Toyosa1
Jan 17, 2018Ret. Employee
I can think of one workaround.
/mgmt/shared/iapp/file-management/
allows you to download a file under the /var/config/rest/iapps/
directory, however, the feature (API) is only available on 13.1.0 or later. For example, to download /var/config/rest/iapps/sat/sat.txt
:
curl https:///mgmt/shared/iapp/file-management/sat/sat.txt
You can use the
/mgmt/tm/util/bash
endpoint and execute cat
command, however, you need to cleanse the response as the file content is JSON formatted: e.g.,
curl https:///mgmt/tm/util/bash \
-X POST -H "Content-Type: application/json" \
-d "{\"command\":\"run\", \"utilCmdArgs\": \"-c 'cat /tmp/sat.txt'\"}"
The response looks like this (The bold part is the file content: 5 lines of text. Note that LF is represented as the literal \n (0x5c 0x6e)):
{"kind":"tm:util:bash:runstate","command":"run","utilCmdArgs":"-c 'cat /tmp/sat.txt'","commandResult":"Line 1\nLine 2\nLine 3\nLine 4\nLine 5\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