WordPress.org

Make WordPress Core

Opened 8 years ago

Closed 10 months ago

#5310 closed enhancement (fixed)

XMLRPC interface should expose mechanism for listing and deleting media resources

Reported by: redsweater Owned by: SergeyBiryukov
Milestone: 4.0 Priority: normal
Severity: normal Version: 2.3.1
Component: XML-RPC Keywords: good-first-bug has-patch commit
Focuses: Cc:

Description

Right now the XMLRPC interface supports the "newMediaObject" mechanism that is part of the MetaWeblog API, but lacks any method for inspecting or otherwise manipulating media objects.

I think to support a richer remote client experience, the XLMRPC interface should support at least a method for listing the media objects that have been previously uploaded (similar to what appears in the "Browse" tab of the wp-admin post editor), and for deleting a media asset that is present.

Attachments (2)

5310_patch.diff (652 bytes) - added by fahmiadib 12 months ago.
5310.diff (1.0 KB) - added by SergeyBiryukov 11 months ago.

Download all attachments as: .zip

Change History (20)

comment:1 @josephscott8 years ago

  • Cc josephscott added

comment:2 @Denis-de-Bernardy6 years ago

itching to move this in Media

comment:3 @westi6 years ago

  • Keywords needs-patch added
  • Milestone changed from 2.9 to Future Release

Needs a patch.

Moving to Future Release for now.

comment:4 follow-up: @johnbillion16 months ago

  • Keywords good-first-bug added

We now have a method for listing items in the media library (wp.getMediaLibrary) but still none for deleting media items.

comment:5 in reply to: ↑ 4 @maxcutler16 months ago

Replying to johnbillion:

... but still none for deleting media items.

Actually, since media items are really just a post type, you can use wp.deletePost method to delete them. Likewise, you can use wp.editPost to modify most of the media item fields (except image and alt-text, the latter of which is a protected meta).

It might be nice to have a simple wrapper to make this more obvious to new users, or else add some documentation to the Codex.

comment:6 @markoheijnen16 months ago

That was exactly the reason why it wasn't added in 3.4 or 3.5

comment:7 @nacin16 months ago

  • Owner josephscott deleted
  • Status changed from new to assigned

comment:8 @nacin13 months ago

We could just add an alias in the methods list.

@fahmiadib12 months ago

comment:9 @fahmiadib12 months ago

Add wp.deleteMediaItem as an alias to wp_deletePost

comment:10 @SergeyBiryukov12 months ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Future Release to 4.0

comment:11 @samuelsidler11 months ago

  • Keywords commit added

comment:12 @ircbot11 months ago

This ticket was mentioned in IRC in #wordpress-dev by helen. View the logs.

comment:13 @SergeyBiryukov11 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from assigned to closed

In 28849:

XML-RPC: Add wp.deleteMediaItem as an alias to wp_deletePost.

props fahmiadib.
fixes #5310.

@SergeyBiryukov11 months ago

comment:14 @SergeyBiryukov11 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I wonder if the alias should be called wp.deleteFile, for consistency with wp.uploadFile. See 5310.diff.

(Whitespace looks weird in the patches here because the whole array is aligned with tabs instead of spaces.)

Last edited 11 months ago by SergeyBiryukov (previous) (diff)

comment:15 @ircbot11 months ago

This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.

comment:16 follow-up: @DrewAPicture11 months ago

+1 for swapping the aliases.

comment:17 in reply to: ↑ 16 @westi10 months ago

Replying to DrewAPicture:

+1 for swapping the aliases.

Agreed.

I think wp.deleteFile is a better name and more consistent with the others.

comment:18 @westi10 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 29255:

XMLRPC: Switch the file deletion alias to be deleteFile to more closely make uploadFile.

Fixes #5310 props SergeyBiryukov.

Note: See TracTickets for help on using tickets.