[wp-trac] [WordPress Trac] #41159: REST API: Add a way to determine if a request is an embedded "sub-request"
WordPress Trac
noreply at wordpress.org
Tue Jul 11 19:35:32 UTC 2017
#41159: REST API: Add a way to determine if a request is an embedded "sub-request"
------------------------------------------+-----------------------------
Reporter: jnylen0 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future Release
Component: REST API | Version: 4.4
Severity: normal | Resolution:
Keywords: needs-patch needs-unit-tests | Focuses: rest-api
------------------------------------------+-----------------------------
Comment (by jnylen0):
The rationale is that an `?_embed` response is not truly context-free -
it's a tree of requests that are all returned at the same time, and it's
occasionally useful to be able to decipher this structure.
For some background, the v1 WP.com REST API does not allow listing or
fetching users or media unauthenticated, so we decided to preserve that
contract when adding the WP REST API and prohibit the same operations
there.
However, it should still be possible to get limited user or media item
details via `?_embed`. My specific use case here is to make this
possible.
Currently this is achieved by watching `rest_request_before_callbacks` and
remembering some information about the "root" request. The solution
described in this ticket would be much less hacky.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41159#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list