Opened 8 years ago
Closed 7 years ago
#37179 closed enhancement (wontfix)
Add _links to the WP-REST-API JSON index.
Reported by: | 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)
Change History (5)
Note: See
TracTickets for help on using
tickets.
Prototype Patch