HTTP GET with request body

Roy Fielding’s comment about including a body with a GET request. Yes. In other words, any HTTP request message is allowed to contain a message body, and thus must parse messages with that in mind. Server semantics for GET, however, are restricted such that a body, if any, has no semantic meaning to the request. … Read more

How do I POST JSON data with cURL?

You need to set your content-type to application/json. But -d (or –data) sends the Content-Type application/x-www-form-urlencoded, which is not accepted on Spring’s side. Looking at the curl man page, I think you can use -H (or –header): Full example: (-H is short for –header, -d for –data) Note that -request POST is optional if you use -d, as the -d flag implies a POST request. On Windows, things are slightly different. See the comment thread.

What is the correct JSON content type?

For JSON text: The MIME media type for JSON text is application/json. The default encoding is UTF-8. (Source: RFC 4627) For JSONP (runnable JavaScript) with callback: Here are some blog posts that were mentioned in the relevant comments: Why you shouldn’t use text/html for JSON Internet Explorer sometimes has issues with application/json A rather complete list of Mimetypes and what to use them for … Read more

What is the correct JSON content type?

For JSON text: The MIME media type for JSON text is application/json. The default encoding is UTF-8. (Source: RFC 4627) For JSONP (runnable JavaScript) with callback: Here are some blog posts that were mentioned in the relevant comments: Why you shouldn’t use text/html for JSON Internet Explorer sometimes has issues with application/json A rather complete list of Mimetypes and what to use them for … Read more

What is the correct JSON content type?

For JSON text: The MIME media type for JSON text is application/json. The default encoding is UTF-8. (Source: RFC 4627) For JSONP (runnable JavaScript) with callback: Here are some blog posts that were mentioned in the relevant comments: Why you shouldn’t use text/html for JSON Internet Explorer sometimes has issues with application/json A rather complete list of Mimetypes and what to use them for … Read more

How do I POST JSON data with cURL?

You need to set your content-type to application/json. But -d (or –data) sends the Content-Type application/x-www-form-urlencoded, which is not accepted on Spring’s side. Looking at the curl man page, I think you can use -H (or –header): Full example: (-H is short for –header, -d for –data) Note that -request POST is optional if you … Read more