Make WordPress Core

Opened 7 months ago

#41554 new enhancement

REST API: Use `wp.apiRequest` helper to build URLs for media embed requests

Reported by: jnylen0 Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: REST API Keywords: needs-patch good-first-bug
Focuses: javascript, administration, rest-api Cc:


Follow-up to #40919.

Let's explore getting rid of the oEmbedProxyUrl property used to pass a REST API URL down to wp-admin code that calls out to this endpoint (example). We can use the helper library introduced in #40919 instead:

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.

Change History (0)

Note: See TracTickets for help on using tickets.