Uploading a file through REST API
Hi all,
I am trying to use the RESP API to upload some file to a DSS managed folder with curl (I need to use curl). The command is the following.
curl -k -u $DSS_PROD_SECRET: -X POST $DSS_HOST/public/api/projects/TEST_PROJECT/managedfolders/Ud4xc2fQ/contents/test_file.txt
I am running this from the same folder where the target file (test_file.txt) resides. I am getting the following error.
{"errorType":"org.springframework.web.multipart.MultipartException","message":"The current request is not a multipart request","detailedMessage":"The current request is not a multipart request","detailedMessageHTML":"\u003cspan\u003e\u003cspan class\u003d\"err-msg\"\u003eThe current request is not a multipart request\u003c/span\u003e\u003c/span\u003e","stackTrace":[]}
Any idea about what I am doing wrong? Thanks!
Best Answer
-
CoreyS Dataiker Alumni, Dataiku DSS Core Designer, Dataiku DSS Core Concepts, Registered Posts: 1,150 ✭✭✭✭✭✭✭✭✭
Your request looks good you are only missing the file as a multipart argument. Your request should look like:
curl -k -u API_KEY: -F file=@LOCAL_PATH_TO_FILE URL
Answers
-
Hi @CoreyS
thanks that worked. Now next question Does DSS accept chunked file upload request? -
Hello,
I think you can easily chunk your file and store the file as chunks in the folder. You can later on create a Files in folder dataset or use a python recipe to merge the chunks into a dataset.
Do you have a use case where you want to send chunks but store them as a single file in the managed folder ?
The size of the chunks you can send mainly depends on your internet connection and the internet connection of your server
Hope it helps,
Arnaud