[wp-trac] [WordPress Trac] #37179: Add _links to the WP-REST-API JSON index.

WordPress Trac noreply at wordpress.org
Sun Jun 26 11:40:09 UTC 2016


#37179: Add _links to the WP-REST-API JSON index.
--------------------------+-----------------------------
 Reporter:  jeremyzahner  |      Owner:
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  REST API      |    Version:  trunk
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37179>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list