Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#37179 closed enhancement (wontfix)

Add _links to the WP-REST-API JSON index.

Reported by: jeremyzahner's profile jeremyzahner Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.6
Component: REST API Keywords: has-patch needs-testing
Focuses: Cc:

Description

To properly implement the HAL-JSON standard, the index of the API should provide a _links section on top level so we could fetch them in a HAL way.

This goes according to RFC6570.
https://tools.ietf.org/html/draft-kelly-json-hal-08#section-5.1

The proposal:

  • The add_index_links function should create a named routes index for all top level collections (like posts, pages, comments).
  • One property of the _links object shall be href (which is either templated or not).
  • If the linked endpoint has query parameters, the templated property should be true and the href should contain an RFC6570 URI-Template.

The benefit:

  • While aligning to the HAL-JSON RFC spec. as good as possible, we could use all kinds of client side libraries.

We will provide a patch for this functionality shortly.

Attachments (1)

patch.diff (3.0 KB) - added by maennchen 8 years ago.
Prototype Patch

Download all attachments as: .zip

Change History (5)

@maennchen
8 years ago

Prototype Patch

#1 @jeremyzahner
8 years ago

  • Keywords has-patch needs-testing added

@maennchen Thanks! ;-)

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


8 years ago

#3 @maennchen
8 years ago

There seems to be no effort to be HAL compatible (See #37182). I think we can close this.

#4 @joehoyle
7 years ago

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

Per @maennchen's suggestion, closing.

Note: See TracTickets for help on using tickets.