Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#39453 closed defect (bug) (wontfix)

WP REST API Response Media Type

Reported by: schlessera Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: REST API Keywords:
Focuses: rest-api Cc:


The WP REST API responses in JSON format are sent using the media type application/json.

However, the API documentation states that it complies to the HAL spec. The HAL spec defines a separate media type, which is identified as application/hal+json.

So, if the WP REST API does indeed use the HAL media type as its response format, it should also use the corresponding identifier.

Note: I assume that it is too late at this point to change the response media type. However, the reasons for keeping the "incorrect" media type should be recorded in a ticket for posteriority.

Link to HAL spec: https://tools.ietf.org/html/draft-kelly-json-hal-07

Change History (3)

This ticket was mentioned in Slack in #core-restapi by kadamwhite. View the logs.

4 years ago

#2 @kadamwhite
4 years ago

We do not fully conform to HAL, because of how our collections are structured; I think keeping application/json makes the most sense. The documentation in the REST API handbook has since been updated to clarify that our relations are inspired by HAL, statements that we conform have been removed.

#3 @jnylen0
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
  • Version changed from 4.7 to 4.4

Also, application/json is much more widely supported than application/hal+json, and even if that weren't the case, as you noted, it is too late to change this. Therefore, closing as wontfix.

Note: See TracTickets for help on using tickets.