[wp-trac] [WordPress Trac] #61739: REST API: Implement 'targetHints' property

WordPress Trac noreply at wordpress.org
Wed Jul 24 09:37:58 UTC 2024


#61739: REST API: Implement 'targetHints' property
-------------------------+-----------------------------
 Reporter:  Mamaduka     |      Owner:  (none)
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  REST API     |    Version:
 Severity:  normal       |   Keywords:
  Focuses:  rest-api     |
-------------------------+-----------------------------
 A proposal to add the `targetHints` property to the link description
 object as part of the `self` link. The current ticket will only cover the
 `allow` header reference.

 Originally suggested in
 https://core.trac.wordpress.org/ticket/50388#comment:6.

 == Why?
 Consumers who render a list of posts and CRUD actions related to each item
 must make a separate `OPTIONS` request to check if the user has permission
 to perform these actions.

 The N+1 requests affect the performance on the client and the server.



 **Example `targetHints` property:**

 {{{#!json
   {
     "_links": {
         "self": [
             {
                 "href": "https://api.w.org/wp-json/wp-json/wp/v2/pages/1",
                 "targetHints": {
                     "allow": [ "GET", "POST", "PUT", "DELETE" ]
                 }
             }
         ]
     }
 }
 }}}

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


More information about the wp-trac mailing list