Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#39453 closed defect (bug) (wontfix)

WP REST API Response Media Type

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

Description

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.


10 years ago

#2 @kadamwhite
10 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
10 years ago

  • Milestone Awaiting Review
  • Resolutionwontfix
  • Status newclosed
  • Version 4.74.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.