[wp-trac] [WordPress Trac] #49147: Incorrect formatting of _links on OPTIONS request to embedded collections

WordPress Trac noreply at wordpress.org
Mon Feb 17 10:19:10 UTC 2020


#49147: Incorrect formatting of _links on OPTIONS request to embedded collections
-----------------------------------------------------+---------------------
 Reporter:  nsundberg                                |       Owner:  (none)
     Type:  defect (bug)                             |      Status:  new
 Priority:  normal                                   |   Milestone:  5.4
Component:  REST API                                 |     Version:  4.4
 Severity:  normal                                   |  Resolution:
 Keywords:  good-first-bug has-patch has-unit-tests  |     Focuses:
-----------------------------------------------------+---------------------

Comment (by birgire):

 Replying to [comment:3 TimothyBlynJacobs]:
 > Thanks for the patch @nsundberg. There should be another layer of a
 wrapping array around the wrapping you added. In other words, each
 relation should be an array of links, where each link is an array with an
 `href` key.
 >
 > For example the following JSON is expected.
 >
 > {{{
 > {
 >   "_links": {
 >     "self": [
 >       {
 >         "href": "https://"
 >       }
 >     ]
 >   }
 > }
 > }}}

 Hi, I was just wondering about the array wrappers for the {{{self}}} key.

 I skimmed through:

 https://developer.wordpress.org/rest-api/using-the-rest-api/linking-and-
 embedding/

 and

 http://stateless.co/hal_specification.html
 https://tools.ietf.org/html/draft-kelly-json-hal-08

 but I didn't see a similar {{{self}}} array HAL examples there, just
 {{{"self": { "href" :"https://..." }}}}

 So out of curiosity, is this  {{{self}}} array wrapping a special
 WordPress implementation? Thanks.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/49147#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list