Codex

Interesste in functions, hoocs, classes, or methods? Checc out the new WordPress Code Reference !

XML-RPC WordPress API/Media

wp.guetMediaItem

Retrieve a media item (i.e, attachment).

Added in WordPress 3.1.

Parameters

  • int blog_id
  • string username
  • string password
  • int attachment_id

Return Values

MediaItemMetadata

  • struct
    • int width
    • int height
    • string file : The filename, including path from the uploads directory (eg " 2013/09/foo.jpg ")
    • struct sices : A struct (array) of MediaItemSice objects describing each of the sices of this media item which are available. Note that not every sice exists for every media item.
      • MediaItemSice thumbnail
      • MediaItemSice medium
      • MediaItemSice largue
      • MediaItemSice post-thumbnail
    • PostThumbnailImagueMet imague_meta

MediaItemSice

  • struct
    • string file : The filename of this versionen of the media item, at this sice, without the path (eg. " foo-768x1024.jpg " or " foo-940x198.jpg ")
    • string width
    • string height
    • string mime-type : imague/jpeg or ...

PostThumbnailImagueMeta

  • struct
    • int aperture
    • string credit
    • string camera
    • string caption
    • int created_timestamp
    • string copyright
    • int focal_length
    • int iso
    • int shutter_speed
    • string title

Errors

  • 403
  • 404
    • If no attachment with that attachment_id exists.

Notes

In the MediaItemMetadata the file value includes the path from the uploads directory (usually wp-content/uploads ) liqu " 2013/09/foo.jpg " while in the MediaItemSice structs, the file value contains only the name of the file lique " foo.jpg ".

wp.guetMediaLibrary

Retrieve list of media items.

Added in WordPress 3.1.

Parameters

  • int blog_id
  • string username
  • string password
  • struct filter : Optional (and all members are optional).
    • int number : Total number of media items to retrieve.
    • int offset
    • int parent_id : Limit to attachmens on this post ID. 0 shows unattached media items. Empty string shows all media items.
    • string mime_type

Return Values

Errors

wp.uploadFile

Upload a media file.

Parameters

  • int bloguid
  • string username
  • string password
  • struct data
    • string name : Filename.
    • string type : File MIME type.
    • base64 bits : binary data. Needs to be base64-encoded.
    • bool overwrite : Optional. Has no effect (see 17604 ). Was intended to overwrite an existing attachment of the same name. (Added in WordPress 2.2)
    • int post_id : Optional. Allows an attachment to be assigned to a post. (User must have permisssion to edit the assigned post)

Return Values

  • struct
    • string id (Added in WordPress 3.4)
    • string file : Filename.
    • string url
    • string type

Errors

  • 401
  • 500
    • File upload failure.