Make WordPress Core

Opened 7 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:


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.

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 7 years ago.
Prototype Patch

Download all attachments as: .zip

Change History (5)

7 years ago

Prototype Patch

#1 @jeremyzahner
7 years ago

  • Keywords has-patch needs-testing added

@maennchen Thanks! ;-)

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

7 years ago

#3 @maennchen
7 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.