API Reference

Media.trashFile

Use this method to trash file(s) from the system.

You must have the media.trashFile permission to call this service on media owned by another user (including the public user). Otherwise you may only trash your own media; you must be logged in to do so. If you do not have permission to trash any of the media specified this function will immediately abort and some media that you specified may be left untrashed.

This method removes any cached data for media.getFileInfo ONLY if media.getFileInfo is called with no user ID and returnComments set to false. If media.getFileInfo is called with a user ID or returnComments set to true then stale data may be returned until the cache is refreshed. This will occur automatically after a few minutes.


Syntax

void media.trashFile ( mixed id, boolean recursive = true )

Arguments

NameTypeRequiredDefault valueDescription
idmixedRequirednoneThis can be a single media ID or an array of valid media IDs.
recursivebooleanOptionaltrueThis optional argument allows you to trash all recursive children of the specified media ID(s). For example this will trash the specified media ID along with all if its comments. Possible values are 0 => false and 1 => true.

Response

The response returned upon success of the request.

NameTypeDescriptionDefault Values
resultINT1 will be returned upon a successful request and response.1

Sample Response

Sample REST Response
http://api.filemobile.com/services/rest/media/trashFile?id=[MEDIA_ID]&status=[MOEDERATION_STATUS]&APIKEY=[APIKEY]
http://api.filemobile.com/services/rest/media/trashFile?id[]=[MEDIA_ID]&id[]=[MEDIA_ID]&status=[MODERATION_STATUS]&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>1</result>
Sample JSON Response
{
    "status": true,
    "result": 1
}

Code examples

0 comments

Be the first to comment on trashFile.

Add a Comment

  • captcha