content-type tagged requests and articles

Categorized request examples and articles tagged with [content-type] keyword
How do I set the content type for a Curl request?
To send the Content-Type header using Curl, you need to use the -H command-line option. For example, you can use the -H "Content-Type: application/json" command-line parameter for JSON data. Data is passed to Curl using the -d command-line option. It must match the provided content type. In this Curl Content-Type example, we are sending JSON to the ReqBin echo URL. Click Run to execute the Curl Content-Type example online and see the results.

What is the MIME Type?
MIME (Multipurpose Internet Mail Extensions) type is a standard way of describing a data type in the body of an HTTP message or email. The MIME type is passed in the Content-Type header. For example, the Content-Type: text/html header tells the browser that it received an HTML page. Based on this MIME-type header, the browser can parse and display the received HTML page correctly. In this {{LANG}} MIME Type Header example, we are sending a request to ReqBin echo URL with Content-Type HTTP header. Click Click Send to run {{LANG}} MIME Type Header example online and see results.

What is the correct Content Type for JSON?
The correct content type for JSON is application/json, and the correct content type for JSONP (padded JSON) is application/javascript. For JSON-LD (JSON-linked data), the correct content type is application/ld+json. Legacy JSON content types, such as text/json, text/x-json, and text/javascript, should be avoided. The Content-Type HTTP header is used to indicate the type of media in the body of the HTTP message. The default encoding for JSON (JavaScript Object Notation) is UTF-8. In this {{LANG}} JSON Content-Type example, we send JSON to the ReqBin echo URL with an application/json Content-Type header. Click Send to execute the {{LANG}} JSON Content-Type request online and see the results.

Content-Type Header
The Content-Type HTTP header is used to indicate the type of media in the body of the message.