API Reference

Media.getFiles

Returns a list of media based on provided parameters.

The actual return value is a struct with the totalCount and data properties. totalCount contains the number of items that would have been returned if there was no offset or limit specified.

pageSize has a maximum value of 500 - ie. no more than 500 media items will ever be returned from a single call to this function.

If no API key is supplied, or there are insufficient permissions, this method will switch to anonymous mode. In that situation, if global moderation is set for this project it will never return unmoderated files.


Syntax

mixed media.getFiles ( mixed vhost, mixed sort = 'upload DESC', array filters = array(), mixed start = 0, mixed limit = 25, mixed fields = array(), mixed noCache = 0, mixed includeCollectionDetails = 0, mixed voter_uid = NULL, mixed includeChildMedia = 0, mixed childFilters = array(), mixed childFields = array(), mixed childSort = NULL, mixed parentFields = array() )

Arguments

NameTypeRequiredDefault valueDescription
vhostmixedRequirednone
sortmixedOptional'upload DESC'
filtersarrayOptionalarray()
startmixedOptional0
limitmixedOptional25
fieldsmixedOptionalarray()
noCachemixedOptional0
includeCollectionDetailsmixedOptional0
voter_uidmixedOptionalNULL
includeChildMediamixedOptional0
childFiltersmixedOptionalarray()
childFieldsmixedOptionalarray()
childSortmixedOptionalNULL
parentFieldsmixedOptionalarray()

Sample Response

Sample REST Response
http://api.filemobile.com/services/rest/media/getfiles?vhost=[VHOST_ID]&filters[channel]=[CHANNEL_ID]&fields[]=avatar&fields[]=channel
<?xml version="1.0" encoding="UTF-8"?>
<result>
  <totalCount>1</totalCount>
  <data>
    <item>
      <avatar>0</avatar>
      <channel>CHANNEL_ID</channel>
      <commentcount>0</commentcount>
      <filetype>4</filetype>
      <hits>0</hits>
      <id>MEDIA_ID</id>
      <message><p>
	This is some test text media</p>
</message>
      <rating>0</rating>
      <status>3</status>
      <tags>media test text example</tags>
      <title>Test text media</title>
      <uid>USER_ID</uid>
      <upload>2012-01-24 14:21:52</upload>
      <user_name>USER_NAME</user_name>
      <vhost>VHOST_ID</vhost>
      <votecount>0</votecount>
      <publicUrl>http://fmdevs3.filemobile.com/storage/MEDIA_ID</publicUrl>
      <thumbUrl>http://fmdev.s3.amazonaws.com/storage/MEDIA_ID</thumbUrl>
      <location>fmdevs3</location>
    </item>
  </data>
  <vhost>VHOST_ID</vhost>
</result>

Sample JSON Response
{
    "status": true,
    "result": {
        "totalCount": 1,
        "data": [
            {
                "avatar": "0",
                "channel": CHANNEL_ID,
                "commentcount": 0,
                "filetype": 4,
                "hits": 0,
                "id": MEDIA_ID,
                "message": "

\r\n\tThis is some test text media

\r\n", "rating": 0, "status": 3, "tags": "media test text example", "title": "Test text media", "uid": 1071107, "upload": "2012-01-24 14:21:52", "user_name": "USER_NAME", "vhost": VHOST_ID, "votecount": 0, "publicUrl": "http://fmdevs3.filemobile.com/storage/MEDIA_ID", "thumbUrl": "http://fmdev.s3.amazonaws.com/storage/MEDIA_ID", "location": "fmdevs3" } ], "vhost": VHOST_ID } }

Code examples

0 comments

Be the first to comment on getFiles.

Add a Comment

  • captcha