Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MIME media type (content type) for representing a URL?

Tags:

mime-types

url

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.

like image 488
Vladimir Dzhuvinov Avatar asked Aug 27 '13 07:08

Vladimir Dzhuvinov


People also ask

What is content MIME type?

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.

What is MIME type example?

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.

Is MIME type same as Content-Type?

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.


2 Answers

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.

like image 149
ryanbrainard Avatar answered Nov 02 '22 00:11

ryanbrainard


text/x-uri should be fine, it's the most used as far as I know.

like image 23
Zhigalin - Reinstate CMs Avatar answered Nov 01 '22 22:11

Zhigalin - Reinstate CMs