API Reference


Use this method to rate a media item on a scale.

When this method is accessed without the use of a API key, user ID is ignored and the current session is being used to determine the user id. A user can only rate once for every file. If the user attempts to vote again, the previous rating will be replaced.

If returnData = 1 then the data from getFileInfo will be returned. This is useful if you need to make further calculations on the new rating.

If returnData = 0 or is not included in the request only the rating value will be returned in the response.


float media.rateFile ( int id, int rating, int uid = 0, bool returnData = false )


NameTypeRequiredDefault valueDescription
idintRequirednoneId of the file you are rating.
ratingintRequirednoneThe rating of the file. HAS to be a number between 1 and 10 (inclusive).
uidintOptional0Userid of the person making the rating.
returnDataboolOptionalfalseFalse (default) to get the rating, true to get the data from getFileInfo.

Response returnData = 1

If returnData = 1 we return all the file information returned from a media.getFileInfo service call. View the full response from the media.getFileInfo service.

ErrorThe rating of the media item.<error><message>Rating has to be an integer between 0 and 10 (inclusive)</message><type>Exception</type><code>0</code></error>

The rating of the file must always be included

If rating is not passed as a valid argument — a number between 0 and 10 an error will be returned.

SuccessThe rating of the media item.<result>10</result>
ErrorThe rating of the media item.<error><message>Rating has to be an integer between 0 and 10 (inclusive)</message><type>Exception</type><code>0</code></error>

Response returnData returnData = 0 of removed from request URL

If returnData = 0 or is not included in the URL we will only return the rating of the media item you just sent the request for.

resultINTThe rating of the media item.

Sample Response

Sample REST Response
<?xml version="1.0" encoding="UTF-8"?>
Sample JSON Response
    "status": true,
    "result": RATING_SENT
Sample REST Response
<?xml version="1.0" encoding="UTF-8"?>
  <message>Test image upload</message>
  <date>2012-01-16 12:00:52</date>
  <title>Test image upload</title>
  <metadata>a:1:{s:4:"user";a:1:{s:8:"demoMeta";s:17:"Test image upload";}}</metadata>
  <upload>2012-01-16 12:00:52</upload>
  <converttime>2012-01-16 12:01:43</converttime>
  <lastupdatetime>2012-02-07 11:37:49</lastupdatetime>
Sample JSON Response
    "status": true,
    "result": {
        "id": MEDIA_ID,
        "status": 3,
        "contenttype": "image/png",
        "filetype": 1,
        "context": 1,
        "filename": "filemobile_llrdpzw4D11qzuk6wo1_500.png",
        "injector": "httpupload",
        "hits": 73,
        "message": "Test image upload",
        "date": "2012-01-16 12:00:52",
        "title": "Test image upload",
        "tags": "",
        "extension": "png",
        "sender": "",
        "author": "",
        "metadata": "a:1:{s:4:\"user\";a:1:{s:8:\"demoMeta\";s:17:\"Test image upload\";}}",
        "uid": USER_ID,
        "filesize": 272138,
        "ofilesize": 127726,
        "upload": "2012-01-16 12:00:52",
        "location": "fmdevs3",
        "originallocation": "",
        "privacy": 0,
        "moderationstatus": 1,
        "width": 498,
        "height": 282,
        "length": "0.00",
        "conversiontime": "3.09329",
        "converttime": "2012-01-16 12:01:43",
        "lastupdatetime": "2012-02-07 12:37:49",
        "offensive": 0,
        "autoblog": "0",
        "rating": 10,
        "votecount": 1,
        "externalid": "",
        "parentid": 0,
        "originalLocation": "",
        "user_name": "USER_NAME",
        "user_email": "USER_EMAIL",
        "user_country": "US",
        "user_city": "asdfasdf",
        "user_state": "CT",
        "user_nickname": "",
        "user_firstname": "FIRSTNAME",
        "user_lastname": "LASTNAME",
        "url": "",
        "vhost": 228,
        "rotation": 0,
        "language": "",
        "channel": CHANNEL_ID,
        "channel_shortname": "content",
        "channel_name": "Content",
        "channelleft": 1,
        "geo_latitude": "53.4842645684215",
        "geo_longitude": "-85.6796875",
        "originalsaved": 1,
        "hidden": "SHOWN",
        "commentcount": 2,
        "approvedcomments": 0,
        "notdeniedcomments": 2,
        "publicUrl": "http://fmdevs3.filemobile.com/storage/MEDIA_ID",
        "thumbUrl": "http://fmdev.s3.amazonaws.com/storage/MEDIA_ID",
        "moderationdeniedid": 1

Code examples


Be the first to comment on rateFile.

Add a Comment

  • captcha