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 )
| Type | Description | |||
|---|---|---|---|---|
| none | Id of the file you are rating. | |||
| none | The rating of the file. HAS to be a number between 1 and 10 (inclusive). | |||
| 0 | Userid of the person making the rating. | |||
| false | False (default) to get the rating, true to get the data from getFileInfo. |
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.
If rating is not passed as a valid argument — a number between 0 and 10 an error will be returned.
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.
<?xml version="1.0" encoding="UTF-8"?> <result>RATING_SENT</result>
{
"status": true,
"result": RATING_SENT
}
<?xml version="1.0" encoding="UTF-8"?>
<result>
<id>MEDIA_ID</id>
<status>3</status>
<contenttype>image/png</contenttype>
<filetype>1</filetype>
<context>1</context>
<filename>filemobile_llrdpzw4D11qzuk6wo1_500.png</filename>
<injector>httpupload</injector>
<hits>73</hits>
<message>Test image upload</message>
<date>2012-01-16 12:00:52</date>
<title>Test image upload</title>
<tags/>
<extension>png</extension>
<sender/>
<author/>
<metadata>a:1:{s:4:"user";a:1:{s:8:"demoMeta";s:17:"Test image upload";}}</metadata>
<uid>USER_ID</uid>
<filesize>272138</filesize>
<ofilesize>127726</ofilesize>
<upload>2012-01-16 12:00:52</upload>
<location>fmdevs3</location>
<originallocation/>
<privacy>0</privacy>
<moderationstatus>1</moderationstatus>
<width>498</width>
<height>282</height>
<length>0.00</length>
<conversiontime>3.09329</conversiontime>
<converttime>2012-01-16 12:01:43</converttime>
<lastupdatetime>2012-02-07 11:37:49</lastupdatetime>
<offensive>0</offensive>
<autoblog>0</autoblog>
<rating>10</rating>
<votecount>1</votecount>
<externalid/>
<parentid>0</parentid>
<originalLocation/>
<user_name>USER_NAME</user_name>
<user_email>USER_EMAIL</user_email>
<user_country>US</user_country>
<user_city>asdfasdf</user_city>
<user_state>CT</user_state>
<user_nickname/>
<user_firstname>FIRST_NAME</user_firstname>
<user_lastname>LAST_NAME</user_lastname>
<url/>
<vhost>VHOST_ID</vhost>
<rotation>0</rotation>
<language/>
<channel>CHANNEL_ID</channel>
<channel_shortname>content</channel_shortname>
<channel_name>Content</channel_name>
<channelleft>1</channelleft>
<geo_latitude>53.4842645684215</geo_latitude>
<geo_longitude>-85.6796875</geo_longitude>
<originalsaved>1</originalsaved>
<hidden>SHOWN</hidden>
<commentcount>2</commentcount>
<approvedcomments>0</approvedcomments>
<notdeniedcomments>2</notdeniedcomments>
<publicUrl>http://fmdevs3.filemobile.com/storage/MEDIA_ID</publicUrl>
<thumbUrl>http://fmdev.s3.amazonaws.com/storage/MEDIA_ID</thumbUrl>
<moderationdeniedid>1</moderationdeniedid>
</result>
{
"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
}
}