I'm using Spring to create a RESTful service and I'm curious about the syntax for media-types.
From my understanding, the general media-type for HAL+JSON is application/hal+json
. Also, from my understanding, a vendor-specific custom media-type that supports HAL+JSON would be something like application/vnd.api.entity.hal+json
. However, I have also seen application/vnd.api.entity+hal+json
. Which one is correct?
Also, what would the correct wild-card type be for HAL+JSON? Would it be application/*.hal+json
or application/*+hal+json
. Links to any pertinent RFC's would be appreciated. Thanks!
application/vnd.api.entity.hal+json
would only make sense if you plan to provide your data also without support forHAL
. The client has to know the structure of the content anyway andHAL
is part of it.application/vnd.api.entity+hal+json
is just wrong. The standard states that only registered suffixes should be used. It also refers to them as "Structured Syntax Suffixes". So it's quite clear that it's about how to read data not about its meaning. Only one suffix is allowed and more wouldn't make sense.Think about it as
application/semantic+syntax
, orapplication/what's in it + how to read it
.