cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to set content type to application/json for a 'metadata' key in a multipart/form-data request

New Member

Unable to set content type to application/json for a 'metadata' key in a multipart/form-data request

I have a multi-part POST request with two parts, a file and json metadata. I am able to  add "file" part and set the content-type through the attachment, but I am not able to set the content-type of the "json" 'metadata' part to "application/json".

2 REPLIES 2
Community Hero

Re: Unable to set content type to application/json for a 'metadata' key in a multipart/form-data req

Hey @DEOKAS,

Im unsure i can help as ive never had a multipart REQUEST before....ive only had to deal with multipart RESPONSES.
However if you explain more people might be able to help.
Once you add the file, what is the type set as?
Have you already set the type as multipart before you attach the file?
You can only have one 'type' set in a single request as far as i was aware, so can you provide the http headers of a multipart POST request with a json file attachment and embedded json payload? Your technical requirements should define the requests http headers and i doubt youd have multiple Content-type headers in a request, so i dont think you actually need to set the type application/json....perhaps you have the application/json set after the multipart portion of the type (either comma or semi colon separated which ive seen on responses).

Essentially we need to know thr http headers of a successful request and work backwards to define what you need....hence the reason im suggesting checking your functional requirements.

Nice one,

Rich
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the Subject header field of the post to something more descriptive? This will help people when searching for problems. Ta
Community Manager

Re: Unable to set content type to application/json for a 'metadata' key in a multipart/form-data req

Thank you Richie!

 

@DEOKAS were you able to solve this? If not, please share more details with us that Richie is asking for🙂


Sonya Mihaljova
Community and Education Specialist

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors