[wp-trac] [WordPress Trac] #41554: REST API: Use `wp.apiRequest` helper to build URLs for media embed requests
WordPress Trac
noreply at wordpress.org
Thu Aug 3 17:41:06 UTC 2017
#41554: REST API: Use `wp.apiRequest` helper to build URLs for media embed requests
-------------------------------------+-------------------------------------
Reporter: jnylen0 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: REST API | Version:
Severity: normal | Keywords: needs-patch good-first-
Focuses: javascript, | bug
administration, rest-api |
-------------------------------------+-------------------------------------
Follow-up to #40919.
Let's explore getting rid of the `oEmbedProxyUrl`
[https://github.com/WordPress/wordpress-develop/blob/1c28b4a/src/wp-
includes/media.php#L3449 property] used to pass a REST API URL down to
`wp-admin` code that calls out to this endpoint
([https://github.com/WordPress/wordpress-develop/blob/1c28b4a/src/wp-
includes/js/media/views/embed/link.js#L56 example]). We can use the
helper library introduced in #40919 instead:
{{{#!js
wp.apiRequest( {
namespace: 'oembed/1.0',
path: '/proxy',
// ...
} );
}}}
This helper will allow us to eliminate all `rest_url` calls passed to
client code through script localization. This will eventually lead to a
lot of duplication, but it seems like it should be very clear from the
requesting code which API endpoint is being called.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/41554>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list