content-type tagged requests and articles

Categorized request examples and articles tagged with [content-type] keyword
MIME Type Example
An example of passing a MIME type of a resource. The MIME type indicates the format of the data in the body of the request or response. The 'Content-Type: application/json' request header tells the server that the request contains a JSON string. The 'Accept: application/json' request header indicates that the client expects JSON media type.

Curl Content Type
An example of making a POST request using Curl with a custom content type header. The -H "Content-Type: application/json" command line option specifies the media type of the resource in the request body. You can use your own mime type here. Data is passed to Curl using the -d command line option. They must match the provided content type.

What is the correct Content Type for JSON?
The official MIME type for JSON (JavaScript Object Notation) is application/json, and the default encoding is UTF-8. For JSONP (padded JSON), the correct content type is application/javascript. For JSON-LD (JSON linked data), the correct content type is application/ld+json. There are some legacy content types for JSON that should be avoided (text/json, text/x-json, text/javascript, etc.).

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