[wp-trac] [WordPress Trac] #38131: REST API: Provide interface to include or exclude specific fields from response JSON

WordPress Trac noreply at wordpress.org
Sun Aug 27 03:08:06 UTC 2017


#38131: REST API: Provide interface to include or exclude specific fields from
response JSON
-------------------------+-----------------------------
 Reporter:  kadamwhite   |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Future Release
Component:  REST API     |     Version:  4.4
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:  performance
-------------------------+-----------------------------

Comment (by TimothyBlynJacobs):

 Attached is an alternate approach that handles the filtering of the
 responses in the controller itself. This matches how the `context`
 parameter works, but it isn't included by default.

 This version also handles nested fields, specifying `title.raw` for just
 the raw title or `title` to retrieve both the raw and rendered title. This
 could also be used by controllers to only calculate the fields as
 necessary. I'm not sure whether this should be used to limit the fields
 queried ( I think that can be done in `WP_User_Query` but I'm not sure
 about the others ). I imagine some of the performance benefits here,
 besides response size, would be not filtering `the_content` if it wasn't a
 requested field, for instance.

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


More information about the wp-trac mailing list