HTTP Commands for User Data File Management
This is the process to manage the user data area on the controller flash memory from an external device (e.g., an HMI) using HTTP communications.
This method uses cURL (http://curl.haxx.se), a command line tool for performing HTTP communication with a server.
-
- The disk space available for the user data area in the controller flash is very limited.
It is strongly recommended to delete the files that are no longer necessary.
See AKD PDMM or PCMM Memory.
The user files in the controller flash can be deleted using either HTTP commands or from the PLC application.
See File Management for available file function blocks.
The URL prefixes for the commands vary based on the controller model.
Use http:// for AKD PDMM and PCMM models.
Use https:// for PCMM2G.
- List directories and files present on the controller flash’s user data folder:
- Upload files onto the controller flash’s user data folder.
Two HTTP requests are sent:- The first request is to authenticate.
- The second request is to upload the file.
- The first request is a POST used to provide credentials to the webserver.
- The cookie received from the server is stored in a temporary cookie.txt file.
- This is used in the second request.
- The username, password, and IP address must be customized for your system.
- The cookie received from the server is stored in a temporary cookie.txt file.
- The second request uploads the file using a HTTP Multipart file upload request.
- The -b cookie.txt at the end is used to add the authentication cookie received after the first request.
- The IP address, sendfile, and filename must be customized for your system.
-
- The first request to provide the credentials to the webserver is not required if the previously logged-in session is still active.
- Deleting files from the controller flash’s user data folder:
curl.exe -k https://(IP_Address)/userfiles
Example Result: { "Directories" : [ { "Name" : "Results" } ], "Files" : [ { "Name" : "TestOutput.csv" } ] }
curl.exe -k -X POST -d "username=administrator" -d "password=administrator" -G https://(IP_Address)/authorize/login -c cookie.txt
curl.exe -k -F "sendfile=@C:\tmp\recipe.txt" -F "filename=recipe.txt" https:// (IP_Address)/userfiles -b cookie.txt
curl.exe -k -X POST -d "username=administrator" -d "password=administrator" -G https://(IP_Address)/authorize/login -c cookie.txt curl.exe -k -X DELETE https://(IP_Address)/userfiles/recipe.txt -b cookie.txt
-
- cURL exists as a C library.
It can be used in compiled software which can be used in the HMI.
If cURL is not an option, equivalent tools can be used if they can POST and PUT HTTP requests and support cookies.
See Also




