Skip to content

Support both plain JSON and HAL+JSON

Compare
Choose a tag to compare
@arucard21 arucard21 released this 17 May 09:40
· 247 commits to master since this release

This release provides full support for representing all resources as either plain JSON with a custom JSON media type or HAL+JSON with a custom profile parameter on the HAL+JSON media type. By default, the plain JSON representation is returned, as this should be more familiar to API consumers. The HAL+JSON representation can be requested through the Accept header, using standard HTTP Content Negotiation. The HAL+JSON representation is recommended for more advanced use of the API as it provides more consistency in the structure of the representation.

This release also provides a filter that allows using application/json in the Accept header to match against any other +json suffixed media type. This allows an API consumer to simply specify application/json in the Accept header in order to get the plain JSON representation. Since this representation uses a custom media type, with the +json suffix, it is not considered compatible with application/json (in native Java code). So if the API consumer were to specify application/json in the Accept header without this filter enabled in the API, the API would return a 406 error. This filter is enabled by default in the convenience deploy libraries.