How to upload a file through API designer

ashwink
Level 1
How to upload a file through API designer

Hi There,

We are using API designer to build the python based services. Usually it allowed to call the service with JSON as request payload.

We have a upload file functionality -  where user choose file to upload it on S3. 

I need to understand how can I use multipart functionality to upload a file using DSS python service.

Please help me to resolve this.

Thanks in advance. 🙂

3 Replies
CoreyS
Community Manager
Community Manager

Hi, @ashwink ! Can you provide any further details on the thread to assist users in helping you find a solution (insert examples like DSS version etc.) Also, can you let us know if you’ve tried any fixes already?This should lead to a quicker response from the community.

Looking for more resources to help you use DSS 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
ashwink
Level 1
Author

Hi @CoreyS ,

Sharing an example of the code snippet. So we are trying to let the user upload a file on S3 using DSS python service (through multipart form data and not JSON). Please note that we are able to achieve this using a flask service but not able to achieve the same through DSS. It may have something to do with DSS accepting only JSON as a format.

 

Let me know if you need more details.

0 Kudos
MarcH
Dataiker
Dataiker

Hi,

You are correct that API services will only accept the query parameters as JSON objects, so uploading a file using multipart/form-data is not possible at the moment.

I'm not sure if this a potential option for you, but you could instead create a simple DSS web app with an upload file button and a Flask backend, as described here: https://community.dataiku.com/t5/Knowledge-Base/Upload-to-DSS-in-a-web-app/ta-p/5441

0 Kudos
A banner prompting to get Dataiku DSS
Public