The error information 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" }
Cause of problem:
Media type refers to Internet media type, Internet media type, also known as MIME type. In the HTTP protocol message header, content type is used to represent 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 image format image/jpeg : jpg image format image/png : png image format
Media format type starting 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 stream data (e.g. common file downloads) application/x-www-form-urlencoded : <form encType=""> in the default encType, form form data is encoded as key/value format and sent to the server (the default form submission format of the data)
Another common media format is used when uploading files:
multipart/form-data : This format is used when file uploads are required in the form
The above is the content format of content type we often use. The message message 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 the post request, and the interface return value is successfully obtained