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.

Flask example with POST

Before actually answering your question: Parameters in a URL (e.g. key=listOfUsers/user1) are GET parameters and you shouldn’t be using them for POST requests. A quick explanation of the difference between GET and POST can be found here. In your case, to make use of REST principles, you should probably have: Then, on each URL, you can define the behaviour of different … 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

System.Net.Http: missing from namespace? (using .net 4.5)

HttpClient lives in the System.Net.Http namespace. You’ll need to add: And make sure you are referencing System.Net.Http.dll in .NET 4.5. The code posted doesn’t appear to do anything with webClient. Is there something wrong with the code that is actually compiling using HttpWebRequest? Update To open the Add Reference dialog right-click on your project in Solution Explorer and select Add Reference…. It should look something like:

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

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)