Make WordPress Core

Opened 7 years ago

Last modified 5 years ago

#41554 new enhancement

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

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

Description

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.

Attachments (2)

41554.diff (3.3 KB) - added by nezhar 7 years ago.
41554.2.diff (3.3 KB) - added by nezhar 7 years ago.

Download all attachments as: .zip

Change History (4)

@nezhar
7 years ago

@nezhar
7 years ago

#1 @nezhar
7 years ago

  • Keywords has-patch added; needs-patch removed

I have done the path a described above. How can I test this actually? I tried by embedding a Youtube video, but I don't think it uses the action that got modified.

This ticket was mentioned in Slack in #core by m.usama.masood. View the logs.


5 years ago

Note: See TracTickets for help on using tickets.