How to upload a file through API designer

ashwink
ashwink Registered Posts: 2 ✭✭✭✭

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.

Answers

  • CoreyS
    CoreyS Dataiker Alumni, Dataiku DSS Core Designer, Dataiku DSS Core Concepts, Registered Posts: 1,150 ✭✭✭✭✭✭✭✭✭

    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.

  • ashwink
    ashwink Registered Posts: 2 ✭✭✭✭

    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.

  • MarcH
    MarcH Dataiker Posts: 26 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

Setup Info
    Tags
      Help me…