[Solved] Postman Error: Unsupported Media Type

The error message is as follows:

{
 " timestamp " : " 2018-12-06T01:37:11.184+0000 " ,
 " status " : 415 ,
 " error " : " Unsupported Media Type " ,
 " message " : " Content type'text/plain;charset=UTF -8' not supported " ,
 " path " : " /testgu/ycyzharry " 
}

problem causes:

Media Type, which is Internet Media Type, is also called MIME type. In the Http protocol message header, Content-Type is used to indicate the media type information in the specific request.
For example: Content-Type: text/html;charset:utf-8;
Common media format types are as follows:

text/ html: HTML format 
text / plain: plain text format       
text / xml: XML format 
image / gif: gif picture format     
image / jpeg: jpg picture format 
image /png: png picture format

Media format types beginning with application:

application/xhtml+ xml: XHTML format 
application / xml: XML data format 
application /atom+ xml: Atom XML aggregation format     
application / json: JSON data format 
application / pdf: pdf format   
application / msword: Word document format 
application /octet- stream: Binary Streaming data (such as common file downloads) 
application /x-www-form-urlencoded: The default encType in <form encType="”>, the form data is encoded in key/value format and sent to the server (the default submission data of the form Format)

Another common media format is used when uploading files:

multipart/form-data: When you need to upload files in the form, you need to use this format

The above is the content format of the content-type that we often use. The message information in this example indicates that the post request does not support the “text/plain” plain text format type.

Solution: Select the “application/json” JSON data format type to send a Post request, and successfully get the interface return value.


Read More:

Leave a Reply

Your email address will not be published. Required fields are marked *