Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Custom content type - is registering with IANA mandatory?

I'm developing an API as RESTful as possible (though the HATEOAS constraint is not met thus it is not a REST API per se)

I'm versioning the API, and since there are several ways to do this, I think I'm going to use the Accept header. I do know the alternatives, but the purpose of this question is not to find a suitable way to version the API.

As far as I know, there are two ways to version API using the Accept header, as seen here, here and here:

application/vnd.company.myapp-v1+json

or using a qualifier

application/vnd.company.myapp+json;v=1

While this is quite clear, I understood that all x- custom content types have been deprecated and vnd. content types have to be registered with IANA.

The API is not and will not be public, all the clients using it are developed internally.

Is registering a custom vnd. content type with IANA mandatory? What happens if the content type is not registered? Can I simply use Accept header application/vnd.company.myapp+json;v=2 even without registering it with IANA?

Since I need a custom content type for content negociation purely for versioning purposes, can I use qualifier such as application/json;v=2 ?

like image 617
Daniel Avatar asked Mar 18 '15 11:03

Daniel


1 Answers

From what I can read from https://www.rfc-editor.org/rfc/rfc6838#section-3.2 it is not mandatory, however if you have and API that is public it is encouraged to do so.

RFC6838 is about registering new MIME/Media Types, with the following text it doesn't seem to be a problem for private API (product)

The vendor tree is used for media types associated with publicly
available products.

Also it is not required for the public API (product), like I said it is encouraged.

While public exposure and review of media types to be registered in
the vendor tree are not required, using the [email protected]
mailing list for review is encouraged, to improve the quality of
those specifications. Registrations in the vendor tree may be
submitted directly to the IANA, where they will undergo Expert Review [RFC5226] prior to approval

like image 132
Albert Bos Avatar answered Oct 08 '22 08:10

Albert Bos