1

I've built some custom routes using the Wordpress REST API (native), and would like to use HAL to reduce the number of server requests.

  1. Does HAL do this (is my premise correct)?

My current header Content-Type is "application/json". Further, when using the &_embed parameter on the default routes, the Content-Type remains "application/json".

  1. Does this mean that the HAL structuring is ineffective?
  2. Does the Content-Type need to be application/json+hal to make a difference?
  3. If necessary, how do I change the Content-Type?

This document – HAL - Hypertext Application Language – claims:

HAL has a media type for both the JSON and XML variants, whos names are application/hal+json and application/hal+xml respectively.

When serving HAL over HTTP, the Content-Type of the response should contain the relevant media type name.

I'm not sure how to interpret this information.

Where can I find good information on testing whether HAL is making a difference?

Paul Sweatte
  • 24,148
  • 7
  • 127
  • 265
fardarter
  • 86
  • 7
  • Don't want to ask this again but still need an answer. Have I asked poorly? – fardarter Jul 11 '17 at 09:45
  • Also trying to change REST API content type header. It seems as though the REST API enforces application/json and doesn't allow any change to the response header. – CodeShaman Mar 07 '18 at 20:26

0 Answers0