Uploading a file through REST API

Solved!
fmonari
Level 2
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!

0 Kudos
1 Solution
CoreyS
Dataiker Alumni

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
Looking for more resources to help you use Dataiku effectively and upskill your knowledge? Check out these great resources: Dataiku Academy | Documentation | Knowledge Base

A reply answered your question? Mark as โ€˜Accepted Solutionโ€™ to help others like you!

View solution in original post

0 Kudos
3 Replies
CoreyS
Dataiker Alumni

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
Looking for more resources to help you use Dataiku effectively and upskill your knowledge? Check out these great resources: Dataiku Academy | Documentation | Knowledge Base

A reply answered your question? Mark as โ€˜Accepted Solutionโ€™ to help others like you!
0 Kudos
fmonari
Level 2
Author

Hi @CoreyS thanks that worked. Now next question Does DSS accept chunked file upload request?

0 Kudos
arnaudde
Dataiker

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