Usually, we send JSON data using the following implementation:
for the Restful API example:
curl -k -X POST $smmUrl/api/elements -H "Authorization:`./login.sh`" -H "Content-
Type:application/json" -d "{\"fme_ip_address\":\"$fme_ip\", \"fme_name\":
\"$fme_name\", \"remote_user\": \"$remote_user\", \"remote_pass\":
\"$remote_pass\"}"
But in this new feature to upload a new firmware of a file the size of about 800 MB.
curl -k -X POST -H "Authorization:`./login.sh`" $smmUrl/api/console/upgrade
-F firmwareUpload=@/.../firmware.tgz
What is the best way to send a file using a POST session?
Problems we are facing:
File is too big for use a read file action.
Send request using session or just do it on a QAction.
Hello Miguel,
I don't know if this will help because our files were a little bit smaller, but I've done something similar, recently.
I ended up creating a POST session on a QAction because we had to add some particular headers that weren't available on the XML.
To start, I would check with Wireshark how the request is being sent when it's done on the GUI.
I would try to mimic what you see.
Here you have an example of the request that we created on a QAction. The dataUsedInForm variable is the content of the file. I would try setting that data on the POST session on the XML. If that doesn't work, I would go for the POST on the QAction, like we did.
You can check the connector Kvarta DVB Stream (QAction 13) to have a better idea how I gather the file for the request. (It's a little bit long to post here 🙂 )
Give me a call if you need any help.
Ana, thank you for your answer. I will probably end up having to send a post request using QAction as well. The problem I’m having is that before I can send the post request, the read file method is not working because of how big the file is. I am using the same method you used in your protocol but it runs into an OUT OF MEMORY exception. I also tried doing asynchronous methods but I am running issues with that.