[wp-trac] [WordPress Trac] #34207: Leverage the REST API structure for the oEmbed endpoint

WordPress Trac noreply at wordpress.org
Fri Oct 9 04:18:01 UTC 2015


#34207: Leverage the REST API structure for the oEmbed endpoint
-------------------------+-------------------------
 Reporter:  swissspidy   |       Owner:  swissspidy
     Type:  enhancement  |      Status:  assigned
 Priority:  normal       |   Milestone:  4.4
Component:  Embeds       |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:
-------------------------+-------------------------

Comment (by rmccue):

 The schema-based pieces that we merged are just for exposing it via an
 `OPTIONS` request, so it's really just bundled documentation more than
 anything. The schema ''can'' be used for more, but that's part of the base
 controller (`WP_REST_Controller`), which is in the endpoints stage. I
 think it's fine as-is.

 The patch looks good to me, though I've only taken a cursory glance so
 far.

 ----

 One thing we might want to consider is a different namespace other than
 `wp/v2` - while this is a core endpoint, it's kind of separate, as it's
 linked to the oEmbed spec, not our endpoint versioning. Perhaps
 `oembed/v1` for the namespace, with the endpoint itself as `embed`.

 Having a separate namespace means a few things. One of these is that
 there's no potential conflicts with the future endpoints (unlikely, but
 possible).

 The main one IMO though is feature detection support: the `namespaces` key
 in the API index indicates which namespaces are available, and lets
 clients detect features. To detect the change from 4.4 to our future
 version with the endpoints, it'd be nice to simply check for `wp/v2` in
 this list. Likewise, you could check for `oembed/v1` here to see if the
 site has oEmbed enabled (if it's missing, the site has probably disabled
 oEmbed).

 If a future oEmbed spec comes out, we could then use `oembed/v2` or
 similar for that, which is a bonus. (This is because we're implementing an
 external specification, rather than making our own.)

 I've convinced myself; let's change it to `oembed/v1` ;)

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


More information about the wp-trac mailing list