API Reference

Media.getFileInfo

Returns a list with information about the specified file.

If the userid parameter is supplied the uservote item is also returned, which contains the vote/rating the user made on the file (if any).

If you are not authenticated using the API key, you will only be able to retrieve information on moderated media.

There is no requirement for any permission to be able to retrieve information about a private media item.


Syntax

array media.getFileInfo ( int id, int uid = NULL, bool returnComments = false, array options = array() )

Arguments

NameTypeRequiredDefault valueDescription
idintRequirednoneThe media ID of the file.
uidintOptionalNULLIf a user ID is supplied we will return 'uservote' item. Uservote contains the vote value the user made on the file we are requesting.
returnCommentsboolOptionalfalseThis specifies if comments will be returned along with the media information. Values can be set to true or false.
optionsarrayOptionalarray()The options array specifies if there a list of group ID's and / or event ID's will be returned that the media item is a member of.

Options

The options array may contain the following parameters.

NameTypeDescriptionDefault Values
includeGroupsbooleanThis may be either 0 or 1 (1 = true or 0 = false). When set to 1, the returned data will include all groups in which the media is present. This option requires the groups.getGroups permission.0
includeEventsbooleanThis may be either 0 or 1 (1 = true or 0 = false). When set to 1, the returned data will include all events in which the media is present. This option requires the events.getEvents permission.0
includeAssignmentsbooleanThis may be either 0 or 1 (1 = true or 0 = false). When set to 1, the returned data will include all assignments in which the media is present. This option requires the groups.getGroups permission.0
includeCollectionsbooleanThis may be either 0 or 1 (1 = true or 0 = false). When set to 1, the returned data will include all manual collections in which the media is present. This option requires the collections.getCollections permission.0
want_exifbooleanIf exif data exists for media, include this information in the metadata section of the response. Value may be 0 or 1. 0
want_xmpbooleanIf xmp data exists for media, include this information in the metadata section of the response. Value may be 0 or 1. 0
want_iptcbooleanIf iptc data exists for media, include this information in the metadata section of the response. Value may be 0 or 1. 0
want_avatar_infobooleanIf user avatar data exists for media, include this information in the avatar_info section of the response. Value may be 0 or 1. 0
want_parent_infobooleanIf parent id data exists for the media, include this information in the parent_info section of the response. Value may be 0 or 1. 0
want_current_timebooleanDetermines if the current server time will be included with the payload, may be 0 or 1. 0
want_meta_arraybooleanWill return metadataArray similar to getFiles in the payload, may be 0 or 1. 0

Response

The responses returned by the getFileInfo service call. Below is a list of all the information returned for a piece of media using the media.getFileInfo service call.

NameDescriptionPossible Values
idThe media ID of the requested media.INT
statusThe upload status of the media ID requested.0,1,2,3
contenttypeThe mimetype of the file, for example: audio/mp3.MIMETYPE
filetypeThe filetype of the requested media item.0,1,2,3,4
contextThe context of the media item. This will be if it is a note, comment, entry etc. 0,1,2,3
filenameThe original file name of the uploaded media item.string/empty
injectorA user-defined string, allows tracking where a file was inserted from.videomixer, feedImporter2, httpupload, MediaFactory.com
hitsThe number of views the media received.INT
messageThe message of the media item.STRING
dateThe date and time for when the file started to be uploaded into MediaFactory.YYYY-MM-DD HH:MM:SS
titleThe title of the media item.STRING
tagsAll the tags associated with the piece of media. Each tag is separated by a space.STRING
extensionThe original file extension of the uploaded media item. An example would be png.STRING
senderThe email address, populated by the email injector. STRING
authorDEPRECATEDempty
metadataAn ARRAY for any additional information that is to be stored with the media item. It is stored as an associated array in this field. The metadata can be set by the user (in the media detail page) or by the developer (via the API). This data is accessible via metadata['<key>']: for example: metadata['synopsis'] or metadata['pin'] metadata['synopsis'] = 'string1' or metadata['pin'] = 'string2'
uidThe ID of the user who uploaded the media into the system.INT
filesizeThe size of the file, in bytes.INT
ofilesizeThe original filesize of the media in KB.INT
uploadThe upload date of the when the file was first uploaded into MediaFactory.YYYY-MM-DD HH:MM:SS
locationThe server location of the uploaded media item.STRING (s3, fmlocal, fmdevs3)
originallocationThe location of where the original file is stored.s3, fmlocal, fmdevs3
privacyDEPRECATEDDEPRECATED
moderationstatusThe current moderation status of the file.0,1,2,3,-1
widthThe original width of the file in pixels.INT
heightThe original height of the file in pixels.INT
lengthThe duration of the file in as a floating point number in seconds. (example: 187.33, for 3 minutes, 7 seconds)NUMBER
conversiontimeThe time it took to convert the file.INT(seconds)
converttimeThe date and time the transcoding of the file was completed.YYYY-MM-DD HH:MM:SS
lastupdatetimeThe date and time of the last update which was made to the file.YYYY-MM-DD HH:MM:SS
offensiveDEPRECATED DEPRECATED
ratingThe rating of the file.INT
votecountThe vote count of the file.INT
externalidThis is the third party ID of the file; it is available only if the file is hosted by one of our partners, such as Twitter, Instagram, Youtube, Brightcove, Widen and Ooyala.

NOTE 1
The external id does not always state the external id provider.

NOTE 2
It is equal to the primary media externalids reference, with the provider being stated in the reference, while in the externalids the provider is stored in the array as `external_id_provider`.

Example:
instagram_image:678386240811661326_1187731501
STRING

Format:
<externalid provider>:<externalid>

Example:
instagram_image:6833326_11458501
parentidThe parent ID of the media item. This would be specified if the media item was a comment. This would be the ID of the media which the commented was made on. INT
originalLocationThe location of where the original file is stored.s3, fmlocal, fmdevs3
user_nameThe user name of the submitter.STRING
user_emailThe email of the submitter.STRING
user_countryThe 2-letter country code of the submitter.STRING
user_cityThe city of the submitter.empty,STRING
user_stateThe 2-letter state or province code of submitter.STRING
user_nicknameThe submitter's nickname.STRING
user_firstnameThe submitter's firstname.empty,STRING
user_lastnameThe last name of the user who uploaded the file.STRING
urlThe URL that could be associated with a media item. STRING
vhostThe ID of the vhost which the file belongs to.INT
languageThe 2-character ISO language code.STRING
channelThe channel ID the file is a member of.INT
channel_shortnameThe given short name the file is a member of.STRING (sample_shortname)
channel_nameThe channel name the file belongs to. STRING
channelleftThe position INT of the channel relative to walking a left channel tree.INT
geo_latitudeThe latitude of the file. This is added via dropping the pin on the map upon upload.NUMBER (62.86)
geo_longitudeThe longitude of the file. This is added via dropping the pin on the map upon upload.NUMBER (-52.44)
hiddenThe visibility of the file.HIDDEN, SHOWN, or ALL
commentcountThe total number of comments made on the file.INT
approvedcommentsThe total number of approved comments made on the file.INT
notdeniedcommentsThe total number of not denied comments made on the file.INT
publicUrlThe publicly accessible url of the media item. This url will log a hit on the piece of media.STRING
thumbUrlthe publicly accessible url used only as a thumbnail for the piece of media. Using the thumb url will NOT log a hit on the media item.STRING
moderationdeniedidThe moderation reason for being denied.Possible values for denied reasons are 0-14. Exact reasons are available in our glossary.
conversionsAn array file conversions which has been executed on the original uploaded file.conversion statustranscoder profile
isLiveReturns if the media was uploaded and is live.true, false
sharesThe number of times the media was shared.INT
externalidsThis is an array of the third party IDs for the file; it is available only if the file is hosted by one of our partners, such as Twitter, Instagram, Youtube, Brightcove, Widen and Ooyala.

The external id provider values are stored as an integer, and are below:
  • 0 - other: any provider other than the 7 mentioned below. You can store any reference using this provider.
    i.e. 'http://www.arbitrarysite.com/image=123'
  • 1 - Brightcove
  • 2 - Youtube
  • 3 - Instagram
  • 4 - Twitter
  • 5 - Widen
  • 6 - Apple
  • 7 - Ooyala


NOTE 1
Each recordset in the array is an array itself that contains the following:
  • external_id (string)
  • external_id_provider (integer)
  • created (the date the externalid record created/updated)
  • vhost
  • primary_external_id (Integer. States whether this is the media's primary external id: possible values: 1 or 0.)
  • .

    NOTE 2Only one record can be the primary external id for each media.

    NOTE 3The record that is noted as the primary external id is stored in the externalid with the reference to the external id provider stated before the external id.
Example

array(
   Array (
     'external_id_provider'=>3,
     'external_id'=>'6136_1186',
     'created'=>'2014-03-19 17:43:11',
     'vhost' => 218,
     'primary_external_id' => 1
   ),

   Array (
     'external_id_provider'=>2,
     'external_id'=>'6136_1186',
     'created' => '2014-03-23 07:52:54',
     'vhost' => 218,
     'primary_external_id' => 0
   )
)
notesThe notes for the media.
Note information includes
  • owner_id
  • username
  • poster_firstname
  • poster_lastname
  • userThumb
  • time (created)
  • comment ( what the note stated )
Array
userinfoThe media owner's info including, but not limited to the list below.
The full list of returned items is on the Docs page for our API call to function users.getUserInfo
  • uid
  • username
  • firstname
  • lastname
  • emai
  • telephone
  • city
  • state
  • country
Array

Sample Response

Sample REST Response
http://api.newspark.ca/services/rest/media/getFileInfo?id=[MEDIA_ID]
<?xml version="1.0" encoding="UTF-8"?>
<result>
  <id>MEDIA_ID</id>
  <status>3</status>
  <contenttype>text/plain</contenttype>
  <filetype>4</filetype>
  <context>1</context>
  <filename/>
  <injector>MediaService1</injector>
  <hits>0</hits>
  <message/>
  <date>2012-01-26 11:29:26</date>
  <title>thisisatitle</title>
  <tags/>
  <extension/>
  <sender/>
  <author/>
  <metadata/>
    <KEY>VALUE</KEY>
  <uid>USER_ID</uid>
  <filesize>0</filesize>
  <ofilesize>0</ofilesize>
  <upload>2012-01-26 11:29:26</upload>
  <location>fmdevs3</location>
  <originallocation/>
  <privacy>0</privacy>
  <moderationstatus>0</moderationstatus>
  <width>0</width>
  <height>0</height>
  <length>0.00</length>
  <conversiontime>0</conversiontime>
  <converttime/>
  <lastupdatetime>2012-01-26 11:29:26</lastupdatetime>
  <offensive>0</offensive>
  <autoblog>0</autoblog>
  <rating>0</rating>
  <votecount>0</votecount>
  <externalid/>
  <parentid>0</parentid>
  <originalLocation/>
  <user_name>USER_NAME</user_name>
  <user_email>EMAIL_ADDRESS</user_email>
  <user_country/>
  <user_city/>
  <user_state/>
  <user_nickname/>
  <user_firstname>FIRSTNAME</user_firstname>
  <user_lastname>LASTNAME</user_lastname>
  <url/>
  <vhost>VHOST_ID</vhost>
  <rotation>0</rotation>
  <language/>
  <channel>0</channel>
  <channel_shortname/>
  <channel_name/>
  <channelleft>0</channelleft>
  <geo_latitude/>
  <geo_longitude/>
  <originalsaved>1</originalsaved>
  <hidden>SHOWN</hidden>
  <commentcount>0</commentcount>
  <approvedcomments>0</approvedcomments>
  <notdeniedcomments>0</notdeniedcomments>
  <publicUrl>http://fmdevs3.filemobile.com/storage/MEDIA_ID</publicUrl>
  <thumbUrl>http://fmdev.s3.amazonaws.com/storage/MEDIA_ID</thumbUrl>
  <moderationdeniedid>0</moderationdeniedid>
  <conversions/>
  <isLive>false</isLive>
</result>
Sample JSON Response
{
    "status": true,
    "result": {
        "id": MEDIA_ID,
        "status": 3,
        "contenttype": "text/plain",
        "filetype": 4,
        "context": 1,
        "filename": "",
        "injector": "MediaService1",
        "hits": 0,
        "message": "",
        "date": "2012-01-26 11:29:26",
        "title": "thisisatitle",
        "tags": "",
        "extension": "",
        "sender": "",
        "author": "",
        "metadata": {
            "KEY": "VALUE"
        },
        "uid": USER_ID,
        "filesize": 0,
        "ofilesize": 0,
        "upload": "2012-01-26 11:29:26",
        "location": "fmdevs3",
        "originallocation": "",
        "privacy": 0,
        "moderationstatus": 0,
        "width": 0,
        "height": 0,
        "length": "0.00",
        "conversiontime": "0",
        "converttime": null,
        "lastupdatetime": "2012-01-26 11:29:26",
        "offensive": 0,
        "autoblog": "0",
        "rating": 0,
        "votecount": 0,
        "externalid": "",
        "parentid": 0,
        "originalLocation": "",
        "user_name": "USER_NAME",
        "user_email": "EMAIL_ADDRESS",
        "user_country": "",
        "user_city": "",
        "user_state": "",
        "user_nickname": "",
        "user_firstname": "FIRSTNAME",
        "user_lastname": "LASTNAME",
        "url": "",
        "vhost": VHOST_ID,
        "rotation": 0,
        "language": "",
        "channel": 0,
        "channel_shortname": null,
        "channel_name": null,
        "channelleft": 0,
        "geo_latitude": null,
        "geo_longitude": null,
        "originalsaved": 1,
        "hidden": "SHOWN",
        "commentcount": 0,
        "approvedcomments": 0,
        "notdeniedcomments": 0,
        "publicUrl": "http://fmdevs3.filemobile.com/storage/MEDIA_ID",
        "thumbUrl": "http://fmdev.s3.amazonaws.com/storage/MEDIA_ID",
        "moderationdeniedid": 0,
        "conversions": [],
        "isLive": "false"
    }
}

Code examples

0 comments

Be the first to comment on getFileInfo.

Add a Comment

  • captcha