How do we post half data in form-data and half in my json

I’m trying to upload some data to an API that accepts json data as well as image files. As form data, it is accepted.
Despite my best efforts, I was unable to find a way to send them both at once. Please help to achieve this.

Hi @Farheen_I, perhaps you can consider posting in the questions category here on the forum going forward? Posts in that category will see a template asking a couple of questions that help with better understanding a problem.perhaps you

On the actual question, requiring both JSON data and binary data at once is quite rare. Most APIs will have separate endpoints for this. Where both at once are required, the binary data is typically encoded using base64 though.

Here’s a quick example POSTing both an image file and other JSON data once:

Hope this helps! If that’s not what you looking for, could you share an example curl request you have working or any documentation with additional details on what your specific API expects?

1 Like

Thanks for your quick help ! I will try by this method and will let you know if I have any other query.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.