Make WordPress Core

Opened 14 years ago

Closed 14 years ago

#15151 closed enhancement (fixed)

Add Media Library calls to XML-RPC

Reported by: frsh's profile frsh Owned by: westi's profile westi
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.1
Component: XML-RPC Keywords: needs-docs
Focuses: Cc:

Description (last modified by westi)

Proposal: Add wp.getMediaLibrary and wp.getMediaLibraryItem calls to XML-RPC.

wp.getMediaLibrary
This call would provide a caller with the ability to get a list of items in the user's Media Library with IDs, titles, descriptions, remote links, and any other relevant metadata. A filter parameter could be provided that would allow the caller to filter based on content type, file size, or other properties.

See get_attachments in http://svn.automattic.com/wordpress/trunk/wp-app.php.

wp.getMediaItem
This call would provide a caller with the ability to get a specific item in the user's Media Library by providing an ID. The call would return the item's ID, title, description, remote link, and any other available metadata.

Attachments (2)

patch-15151-1.diff (3.8 KB) - added by koke 14 years ago.
Proposed patch for getMediaItem/getMediaLibrary
patch-15151-2-doc.diff (2.7 KB) - added by koke 14 years ago.
Added documentation. Also corrected default value for parent_id

Download all attachments as: .zip

Change History (16)

#1 @frsh
14 years ago

  • Component changed from General to XML-RPC

#2 @westi
14 years ago

  • Description modified (diff)

#3 @westi
14 years ago

  • Owner set to westi
  • Status changed from new to accepted

#4 @mtdewvirus
14 years ago

  • Cc mtdewvirus@… added

#5 @koke
14 years ago

  • Cc koke added

@koke
14 years ago

Proposed patch for getMediaItem/getMediaLibrary

#6 @koke
14 years ago

Hi, there is a proposed solution for this. Inspired by the getComments function, the getMediaLibrary calls getMediaItem for every attachment found. This results in showing more info about each item.

Maybe it needs another argument to decide how much info we want from the media library, but that would depend on the use cases.

Any suggestions on this?

#7 @koke
14 years ago

  • Keywords has-patch dev-feedback added

#8 @frsh
14 years ago

  • Cc frsh added

This is looking good on my 3.0.1 install. Much appreciated!

#9 @westi
14 years ago

  • Milestone changed from Awaiting Review to 3.1

#10 @westi
14 years ago

Going through this now.

For reference some style comments on the patch:

  • Better to use the ternary operator when setting up variable to a default of a value from elsewhere.
  • Foreach ing over the results is nicer that an indexed for loop.

Committing modified version

#11 @westi
14 years ago

(In [16016]) First pass at 'wp.getMediaItem' and

'wp.getMediaLibrary'. See #15151 props koke.

#12 @westi
14 years ago

  • Keywords needs-docs added; media library xml-rpc has-patch dev-feedback removed

@koke
14 years ago

Added documentation. Also corrected default value for parent_id

#13 @westi
14 years ago

(In [16046]) phpDoc and a bug fix for the new media XMLRPC functions. See #15151 props koke.

#14 @westi
14 years ago

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

No negative feedback on this closing as fixed.

Note: See TracTickets for help on using tickets.