I'm looking for the correct MIME media type (or content type) for documents that contain a single URL such as http://example.com/123/abc.
I checked IANA's MIME type registry, but couldn't find a suitable one for a URL or URI.
Should I create a custom MIME type for this purpose or use the closest registered that applies? It will be used by a RESTful API that returns a URL in the HTTP body for specific calls, to differentiate from others that do not.
Content Type is also known as MIME (Multipurpose internet Mail Extension)Type. It is a HTTP header that provides the description about what are you sending to the browser.
MIME types enable browsers to recognize the filetype of a file which has been sent via HTTP by the webserver. As a result the browser is able to choose a suitable displaying method. Common MIME types are for example text/html for html-files or image/jpeg for jpeg-files.
content_type is an alias for mimetype. Historically, this parameter was only called mimetype, but since this is actually the value included in the HTTP Content-Type header, it can also include the character set encoding, which makes it more than just a MIME type specification.
You should be able to use text/uri-list
defined in RFC 2483 Section 5. You are only returning a single URL, but there is nothing in the spec saying it can't be a list of one. To conform to the spec, just make sure the URL is all on one line and terminated with a CRLF pair.
text/x-uri
should be fine, it's the most used as far as I know.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With