Device1.2

Empty Trash


GET http://www.mediafire.com/api/1.2/device/empty_trash.php
POST http://www.mediafire.com/api/1.2/device/empty_trash.php

Description : Empties out the content of the trash can. If the trash has too many items, then the API will return immediately with the property asynchronous=yes and the operation will be performed in the background.

Required Parameters:


Relative Parameters:

  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters:

  • device_id : The ID of the device. If not passed, it would return files and folders from the cloud.
  • response_format : 'xml' or 'json' (default 'xml')


Response Properties


Name Description Type
asynchronous This property tells whether the request is being processed real-time. If the job is processed asynchronously, callers will need to poll device/get_status to determine when their job is complete. 'yes' or 'no' yes/no flag
device_revision The revision number of the device integer
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:

Request
http://www.mediafire.com/api/1.2/device/empty_trash.php?session_token=0a7ae1b77061da54796078b3906b7a7bab9747dc6e7848876674eca0055821c85196e164f1fa1d17cfcf9b2dea8268b42b920b3b7948f4de4cbab9c716bcb827267e3f3a6341dc60
Response
<response>
  <action>device/empty_trash</action>
  <asynchronous>yes</asynchronous>
  <result>Success</result>
  <current_api_version>1.2</current_api_version>
</response>
Example 2 (Success with JSON):
Request
http://www.mediafire.com/api/1.2/device/empty_trash.php?session_token=0a7ae1b77061da54796078b3906b7a7bab9747dc6e7848876674eca0055821c85196e164f1fa1d17cfcf9b2dea8268b42b920b3b7948f4de4cbab9c716bcb827267e3f3a6341dc60&response_format=json

Response
{
  "response": {
    "action": "device/empty_trash",
    "asynchronous": "yes",
    "result": "Success",
    "current_api_version": "1.2",
    "device_revision": "4585"
  }
}

Follow Resource


GET http://www.mediafire.com/api/1.2/device/follow_resource.php
POST http://www.mediafire.com/api/1.2/device/follow_resource.php

Description : Grants the current user read permissions for the specified resource .

Required Parameters:


Relative Parameters:

  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters:

  • response_format : 'xml' or 'json' (default 'xml')


Response Properties


Name Description Type
device_revision The revision number of the device integer
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:


Example 2 (Success with XML):

Request
http://www.mediafire.com/api/1.2/device/follow_resource.php?resource=QUICKKEY_OR_FOLDERKEY&session_token=TOKEN&signature=SIGNATURE
Response
<response>
    <action>device/follow_resource</action>
    <device_revision>123</device_revision>
    <result>Success</result>
    <current_api_version>1.2</current_api_version>
</response>

Example 2 (Success with JSON):

Request
http://www.mediafire.com/api/device/follow_resource.php?resource=uz9u9zqa0tlk6z7&session_token=88015ddfeb6b5681a4de1d74d295e9dfb8e5d857e8977e717acac7c8b8edf302b3fa3e9193e24d041b60ead56570e8c6acb94c0497d7fc22479fe4b1af01c9eabc87c209121ae322&response_format=json

Response
{
  "response": {
    "action": "device/follow_resource",
    "device_revision": "123",
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Get Changes


GET http://www.mediafire.com/api/1.2/device/get_changes.php
POST http://www.mediafire.com/api/1.2/device/get_changes.php

Description : Returns the list of all files and folders with revisions greater than the passed parameter revision and less than or equal to the next 500-multiplier. For example, if revision=1211, then all files and folders with revision greater than 1211 and less than or equal 1500 are returned.

Required Parameters:

  • session_token : A type 1 or type 2 session token. (Type 2 will require a call signature).
  • revision : The device revision after which the changes to be returned occur.

Relative Parameters:

  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters:

  • device_id : The ID of the device. If not passed, it would return files and folders from the cloud.
  • response_format : 'xml' or 'json' (default 'xml')


Response Properties

Name Description Type
changes_list_block Indicated which 500 block was specified for the call
device_revision The revision number of the device integer
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Returned responses for updated files
Name Description Type
quickkey quickkey of the file that was updated string
filename The name of the updated file string
mimetype The mimetype of the updated file string
filetype The filetype of the updated file: 'presentation,' 'spreadsheet,' 'image,' 'document,' etc. string
revision The revision number of the updated file integer
created The date and time the file was created string timestamp
grafted 'yes' or 'no' yes/no flag
parent_folderkey The parent folderkey of the updated file string
parent_foldername The parent foldername of the updated file string

Returned responses for updated folders
Name Description Type
folderkey The folderkey for the updated folder string
revision The revision number of the updated folder integer
grafted 'yes' or 'no' yes/no flag
parent_folderkey The parent folderkey of the updated folder string

Returned responses for deleted files
Name Description Type
quickkey The quickkey of the file that was deleted string
revision The revision number of the deleted file integer
created The date and time the file was created string timestamp
grafted 'yes' or 'no' yes/no flag
parent_folderkey The parent folderkey of the deleted file string

Returned responses for deleted folders
Name Description Type
folderkey The folderkey for the deleted folder string
revision The revision number of the deleted folder integer
grafted 'yes' or 'no' yes/no flag
parent_folderkey: The parent folderkey of the updated folder string

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:


Example 1(A response showing changes with XML):

Request
http://www.mediafire.com/api/1.2/device/get_changes.php?session_token=de8f7c427c7a1e84134175880ca5f7f959a6d2894a47fcc7457ecb65fd930785f72801bc6b2b54be2284baf05a17b4098b47074eff4685259f3a205929e6832ce5e6e9c9affdb3d3&revision=53
Response
<response>
    <action>device/get_changes</action>
    <updated>
        <files>
            <file>
                <quickkey>fl4fo8nfc4np3cv</quickkey>
                <revision>61</revision>
                <created>2013-04-23 12:01:21</created>
                <parent_folderkey/>
            </file>
            <file>
                <quickkey>2xd01t7y56z5vml</quickkey>
                <revision>64</revision>
                <created>2013-04-21 22:42:16</created>
                <parent_folderkey>pdwq948fyr7r7</parent_folderkey>
            </file>
            <file>
                <quickkey>94bc9vocqwu3dh</quickkey>
                <revision>62</revision>
            </file>
        </files>
        <folders>
            <folder>
                <folderkey>vnp2fvf2mionv</folderkey>
                <revision>72</revision>
            </folder>
            <folder>
                <folderkey>apfsoiaspoisd</folderkey>
                <revision>71</revision>
            </folder>
        </folders>
    </updated>
    <deleted>
        <files>
            <file>
                <quickkey>qnbvekwvndddfg5</quickkey>
                <revision>77</revision>
                <created>2013-04-16 02:10:33</created>
                <parent_folderkey/>
            </file>
        </files>
        <folders>
            <folder>
                <folderkey>gvbweicun3b9y</folderkey>
                <revision>73</revision>
            </folder>
        </folders>
    </deleted>
    <device_revision>105</device_revision>
    <result>Success</result>
    <current_api_version>1.2</current_api_version>
</response>

Example 2 (A Response Showing Changes with JSON):

Request
http://www.mediafire.com/api/1.2/device/get_changes.php?session_token=de8f7c427c7a1e84134175880ca5f7f959a6d2894a47fcc7457ecb65fd930785f72801bc6b2b54be2284baf05a17b4098b47074eff4685259f3a205929e6832ce5e6e9c9affdb3d3&revision=530
Response
{
  "response":
  {
    "action":"device\/get_changes",
    "updated":"",
    "deleted":"",
    "device_revision":"42282",
    "changes_list_block":"530",
    "result":"Success",
    "current_api_version":"1.2"
  }
}

Example 3 (A response showing no changes with JSON):
Request
http://www.mediafire.com/api/1.2/device/get_changes.php?revision=53&session_token=de8f7c427c7a1e84134175880ca5f7f959a6d2894a47fcc7457ecb65fd930785f72801bc6b2b54be2284baf05a17b4098b47074eff4685259f3a205929e6832ce5e6e9c9affdb3d3&response_format=json


Response
{
  "response": {
    "action": "device/get_changes",
    "updated": {
      "files": [
        {
          "quickkey": "fl4fo8nfc4np3cv",
          "revision": "61",
          "created": "2013-04-23 12:01:21",
          "grafted": "no"
        },
        {
          "quickkey": "2xd01t7y56z5vml",
          "revision": "64",
          "created": "2013-04-21 22:42:16",
          "grafted": "no",
          "parent_folderkey": "pdwq948fyr7r7"
        },
        {
          "quickkey": "94bc9vocqwu3dh",
          "revision": "62",
          "created": "2011-05-12 11:41:12",
          "grafted": "yes"
        }
      ],
      "folders": [
        {
          "folderkey": "vnp2fvf2mionv",
          "revision": "72",
          "grafted": "no"
        },
        {
          "folderkey": "apfsoiaspoisd",
          "revision": "71",
          "grafted": "yes"
        }
      ]
    },
    "deleted": {
      "files": [
        {
          "quickkey": "qnbvekwvndddfg5",
          "revision": "77",
          "created": "2013-04-16 02:10:33",
          "grafted": "no",
          "parent_folderkey": "trash"
        }
      ],
      "folders": [
        {
          "folderkey": "gvbweicun3b9y",
          "revision": "73",
          "grafted": "no",
          "parent_folderkey": "trash"
        }
      ]
    },
    "device_revision": "105",
    "changes_list_block": "500",
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Get Foreign Resources


GET http://www.mediafire.com/api/1.2/device/get_foreign_resources.php
POST http://www.mediafire.com/api/1.2/device/get_foreign_resources.php

Notes: Response property md5 is named erroneously and has been deprecated. It is replaced with response property hash.

Description : Gets information about resources shared with the current user.

Required Parameters:


Relative Parameters:

  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters:

  • chunk : Which segment of the data to return (0 = all).
  • sort_by : Key of the column by which to sort (currently supports 'name', 'size', 'sync', 'date_created', 'date_shared').
  • reverse : If '1', sort descending; otherwise, ascending.
  • type : Filter foreign resources by resource type ('files' or 'folders').
  • sync : Filter foreign resources by resource 'sync to desktop' status (0 = no, 1 = yes).
  • contact : Filter foreign resources by user's contact key.
  • filetype : Filter foreign resources by file type ('application', 'archive', 'audio', 'development', 'document', 'image', 'presentation', 'spreadsheet', or 'video')
    No need to filter by 'type' if you specify this as only files will be returned.
  • response_format : 'xml' or 'json' (default 'xml')


Response Properties


Name Description Type
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Responses for Files
Name Description Type
md5 DEPRECATED string
hash The hash of the file. NEW string
quickkey The quickkey of the file string
filename The name of the file string
created The date and time the file was created string timestamp
desc The description of the file string
revision The revision number of the file integer
size The size of the file (in bytes) integer
mimetype The MIME type of the file string
share_link_enabled Share link enabled. '0' for no and '1' for yes. integer flag
filetype The filetype: 'presentation,' 'spreadsheet,' 'image,' 'document,' etc. string
view Specifies if this file is viewable via MediaFire and, if so, by what system. 0 [not-viewable], 1 [PDF Viewer], 2 [PDF Viewer], 3 [deprecated]. integer
edit Specifies if this file can be edited via MediaFire and, if so, by what system. 0 [not-editable], 1 [Text Editor], 2 [deprecated]. integer
date_shared The date and time the file was shared integer timestamp
resource_key The quickkey of the file string
attributes Indicates if the resource is a file or a folder. Bit 0 = folder; 1 = file bitmask
permissions The permissions granted to the user for this file. Bit 0 = read; 1 = read + write; 2 = manage. bitmask
options **see note below bitmask
Note Regarding the Property 'options': The following is a list of bits and their meanings (if the meaning is not listed, it is an internal MediaFire notation and not for public use):
  • 1: File is owned by the session user.
  • 2: File is supported for preview.
  • 4: File is editable.

Returned Responses for Folders
Name Description Type
folderkey The folderkey of the shared folder string
name The foldername of the shared folder string
desc The description of the folder string
created The date and time the folder was created string timestamp
revision The revision number of the folder integer
share_link_enabled Whether or not the folder is public (share link enabled) or private. '0' for share link is not enabled (private) or '1' for share link is enabled (public) integer flag
date_shared The date and time the folder was shared string timestamp
resource_key The folderkey for the folder string
attributes Indicates if the resource is a file or a folder. Bit 0 = folder; 1 = file. bitmask
permissions The permissions granted to the user for this file. Bit 0 = read; 1 = read + write; 2 = manage. bitmask
options A bitmask value indicating special details about the session user and the account. [see note below for details] bitmask
sharer The contactkey of the person who shared the folder string
Note Regarding the Property 'options': The following is a list of bits and their meanings (if the meaning is not listed, it is an internal MediaFire notation and not for public use):
  • 1: Folder is owned by the session user.
  • 2: Folder is supported for preview.
  • 4: Folder is editable.

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:


Example 1(Success with XML):

Request
http://www.mediafire.com/api/1.2/device/get_foreign_resources.php?session_token=TOKEN&signature=SIGNATURE&chunk=1
Response
<response>
    <action>device/get_foreign_resources</action>
    <files>
      <file>
        <md5>adbc3e427c1aa98ba91cfd66ea29ecdac92f76de46a270928ff274d2879adbe2</md5>
        <quickkey>m3tgr0t7cx9lygy</quickkey>
        <filename>Getting Started with MediaFire.pdf</filename>
        <created>2014-02-01 19:50:42</created>
        <desc></desc>
        <revision>114</revision>
        <size>3176338</size>
        <mimetype>application/pdf</mimetype>
        <share_link_enabled>0</share_link_enabled>
        <filetype>document</filetype>
        <view>1</view>
        <edit>0</edit>
        <hash>adbc3e427c1aa98ba91cfd66ea29ecdac92f76de46a270928ff274d2879adbe2</hash>
        <date_shared>2014-09-28 12:02:31</date_shared>
        <resource_key>m3tgr0t7cx9lygy</resource_key>
        <attributes>2</attributes>
        <permissions>2</permissions>
        <options>0</options>
        <sharer>8k38x9f</sharer>
      </file>
    </files>
    <folders>
      <folder>
        <folderkey>r3mh9hby1wux1</folderkey>
        <name>Photos</name>
        <desc></desc>
        <created>2014-02-01 19:50:40</created>
        <revision>154</revision>
        <share_link_enabled>0</share_link_enabled>
        <date_shared>2014-09-28 12:04:55</date_shared>
        <resource_key>r3mh9hby1wux1</resource_key>
        <attributes>1</attributes>
        <permissions>2</permissions>
        <options>0</options>
        <sharer>8k38x9f</sharer>
      </folder>
    </folders>
    <result>Success</result>
    <current_api_version>1.2</current_api_version>
  </response>
Example 2 (Success with JSON):
Request
http://www.mediafire.com/api/1.2/device/get_foreign_resources.php?chunk=1&session_token=de8f7c427c7a1e84134175880ca5f7f959a6d2894a47fcc7457ecb65fd930785f72801bc6b2b54be2284baf05a17b4098b47074eff4685259f3a205929e6832ce5e6e9c9affdb3d3&response_format=json
Response
{
  "response": {
    "action": "device/get_foreign_resources",
    "files": [
      {
        "md5": "adbc3e427c1aa98ba91cfd66ea29ecdac92f76de46a270928ff274d2879adbe2",
        "quickkey": "m3tgr0t7cx9lygy",
        "filename": "Getting Started with MediaFire.pdf",
        "created": "2014-02-01 19:50:42",
        "revision": "114",
        "size": "3176338",
        "mimetype": "application/pdf",
        "share_link_enabled": "2",
        "filetype": "document",
        "view": "1",
        "edit": "0",
        "hash": "adbc3e427c1aa98ba91cfd66ea29ecdac92f76de46a270928ff274d2879adbe2",
        "date_shared": "2014-09-28 12:02:31",
        "resource_key": "m3tgr0t7cx9lygy",
        "attributes": "2",
        "permissions": "2",
        "options": "0",
        "sharer": "8k38x9f"
      }
    ],
    "folders": [
      {
        "folderkey": "r3mh9hby1wux1",
        "name": "Photos",
        "created": "2014-02-01 19:50:40",
        "revision": "154",
        "share_link_enabled": "no",
        "date_shared": "2014-09-28 12:04:55",
        "resource_key": "r3mh9hby1wux1",
        "attributes": "1",
        "permissions": "2",
        "options": "0",
        "sharer": "8k38x9f"
      }
    ],
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Get Patch


GET http://www.mediafire.com/api/1.2/device/get_patch.php
POST http://www.mediafire.com/api/1.2/device/get_patch.php

Notes: Before making this call, several steps need to be followed. First, assuming you have a cached copy of your cloud content, compare the last known file revision to that which is returned by file/get_info. If you are out-of-date, call device/get_updates and specify the last known revision number of the file. This will return a "patch replay" history of the file. Follow the "patch replay" history in chronological order using device/get_patch to acquire download URLs for each patch. Last, make another call to file/get_info to see if you are up-to-date and to determine if you need any additional patches.

Description : When an updated version of a large file needs to be synced from the cloud to a client's system, a significant amount of bandwidth is utilized. With device/get_patch you can greatly reduce sync and bandwidth overhead by allowing the caller to download a smaller set of incremental differentials which can be applied, in sequence, to a file until the file is current. Because patch files are smaller, less bandwidth and time are required.

Required Parameters:

  • session_token : A type 1 or type 2 session token. (Type 2 will require a call signature).
  • quick_key : The quickkey that identifies the patch file. Patches have the same quickkeys as the full file they apply to.
  • source_revision : The source revision number of the patch.
  • target_revision : The target revision number of the patch.

Relative Parameters:

  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters:

  • response_format : 'xml' or 'json' (default 'xml')


Response Properties

Name Description Type
patch_link The download URL of the patch file string
patch_hash The hash of the patch file string
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:


Example 1(Success with XML):

Request
http://www.mediafire.com/api/1.2/device/get_patch.php?session_token=f96070e121f994291afa8f9e829b517b6936e58ec9d61293d9b65c4979d0159e031e852037bf4a827a25b9d60d0e16238bdb8abd5ee36cf258446fd4dcdfa8a79c171bc444a3684b&quick_key=2oc3180v9w8vohv&source_revision=11398&target_revision=11399
Response
<response>
    <action>device/get_patch</action>
    <patch_link>http://205.196.123.34/uc3jppfi4cmg/2od3180v9w8vohv/desktop.ini.patch.50398.50399</patch_link>
    <patch_hash>3e216115bf425e7851cb3310656279109884e672aca190db13601ca2a5e4af57</patch_hash>
    <result>Success</result>
    <current_api_version>1.2</current_api_version>
</response>

Example 2 (Success with JSON):

Request
http://www.mediafire.com/api/device/get_patch.php?quick_key=2oc3180v9w8vohv&source_revision=11398&target_revision=11399&session_token=f96070e121f994291afa8f9e829b517b6936e58ec9d61293d9b65c4979d0159e031e852037bf4a827a25b9d60d0e16238bdb8abd5ee36cf258446fd4dcdfa8a79c171bc444a3684b&response_format=json
Response
{
  "response": {
    "action": "device/get_patch",
    "patch_link": "http://205.196.123.34/uc3jppfi4cmg/2od3180v9w8vohv/desktop.ini.patch.50398.50399",
    "patch_hash": "3e216115bf425e7851cb3310656279109884e672aca190db13601ca2a5e4af57",
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Get Resource Shares


GET http://www.mediafire.com/api/1.2/device/get_resource_shares.php
POST http://www.mediafire.com/api/1.2/device/get_resource_shares.php

Description : Returns a list of contacts, along with their permissions, of a shared file or folder.

Required Parameters:


Relative Parameters:

  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters:

  • response_format : 'xml' or 'json' (default 'xml')

Response Properties

Name Description Type
contact_key Key representing a user relationship, found in lr_contacts.contacts string
contact_type The type of the contact (mediafire, gmail, twitter, etc) string
contact_indirect Whether the contact is direct (0) or indirect (1). A contact is indirect if the user did not directly share with this contact but rather the contact is following this resource because it was publicly shared. integer flag
display_name Name or e-mail of the contact string
avatar URI for the contact's avatar image string
permissions Bit @offset 0 = read; @offset 1 = read + write; @offset 2 = manage(NOT IN USE). bitmask
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:


Example 1(Success with XML):

Request
http://www.mediafire.com/api/1.2/device/get_resource_shares.php?session_token=TOKEN&resource=QUICKKEY_OR_FOLDER_KEY
Response:
<response>
    <action>device/get_resource_shares</action>
    <shares>
        <share>
            <contact_key>1234567</contact_key>
			<contact_type>1</contact_type>
			<contact_indirect>0</contact_indirect>
            <display_name>Johnny MediaFire</display_name>
            <avatar>URI_FOR_AVATAR_IMAGE</avatar>
            <permissions>2</permissions>
        </share>
    </shares>
    <result>Success</result>
    <current_api_version>1.2</current_api_version>
</response>

Example 2 (Success with JSON):

Request
http://www.mediafire.com/api/device/get_resource_shares.php?resource=uz9u9zqa0tlk6z7&session_token=88015ddfeb6b5681a4de1d74d295e9dfb8e5d857e8977e717acac7c8b8edf302b3fa3e9193e24d041b60ead56570e8c6acb94c0497d7fc22479fe4b1af01c9eabc87c209121ae322&response_format=json
Response
{
  "response": {
    "action": "device/get_resource_shares",
    "shares": [
      {
        "contact_key": "1234567",
        "contact_type": "1",
        "contact_indirect": "0",
        "display_name": "Joe Blow",
        "avatar": "URI_FOR_AVATAR_IMAGE",
        "permissions": "2"
      }
    ],
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Get Status


GET http://www.mediafire.com/api/1.2/device/get_status.php
POST http://www.mediafire.com/api/1.2/device/get_status.php

Description: Returns various information about the status of a device specified by device_id.

Required Parameters:


Relative Parameters:
  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters:

  • device_id : The ID of the device. If not passed, it would return the status of the cloud device.
  • simple_report : 'yes' or 'no' (default 'no'). Determines if the async_jobs_in_progress field is returned.
  • response_format : 'xml' or 'json' (default 'xml')


Response Properties

Name Description Type
device_revision Holds the current revision number for the device. integer
async_jobs_in_progress Indicates whether the user has asynchronous jobs running on the back-end. 'yes' or 'no' yes/no flag
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:

Request
http://www.mediafire.com/api/1.2/device/get_status.php?session_token=de8f7c427c7a1e84134175880ca5f7f959a6d2894a47fcc7457ecb65fd930785f72801bc6b2b54bd2284baf05a17b4098b47074eff4685259f3a205929e6832ce5e6e9c9affdb3d3
Response
<response>
    <action>device/get_status</action>
    <async_jobs_in_progress>yes</async_jobs_in_progress>
    <result>Success</result>
    <current_api_version>1.2</current_api_version>
</response>
Example 2 (Success with JSON):

Request
http://www.mediafire.com/api/device/get_status.php?session_token=de8f7c427c7a1e84134175880ca5f7f959a6d2894a47fcc7457ecb65fd930785f72801bc6b2b54bd2284baf05a17b4098b47074eff4685259f3a205929e6832ce5e6e9c9affdb3d3&response_format=json
Response
{
  "response": {
    "action": "device/get_status",
    "device_revision": "101127",
    "async_jobs_in_progress": "yes",
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Get Trash


GET http://www.mediafire.com/api/1.2/device/get_trash.php
POST http://www.mediafire.com/api/1.2/device/get_trash.php

Notes: Two optional parameters have been added: content_type and chunk. Also, results are now chunked. To get the total number of chunks divide either folder_count or file_count by chunk_size and round any remainder up. Additionally, it is no longer possible to obtain both folders and files in a single API response.

Description: Returns the trash can folder data and the list of immediate files and folders in the trash can. Contents of subfolders in the trash can will not be returned.

Required Parameters:


Relative Parameters:

  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters:

  • device_id : The ID of the device. If not passed, it would return files and folders from the cloud's trash can.
  • data_only : Return trash can folder data only, 'yes' or 'no' (default 'no').
  • content_type : The type of content requested. "folders" or "files" (default: "folders").
  • chunk : The chunk number starting from 1.
  • response_format : 'xml' or 'json' (default 'xml')

Response Properties

Name Description Type
folder_count The amount of folders in the user's trash integer
file_count The amount of files in the user's trash integer
result Indicates if the API call was successful. 'Success' or 'Failure' string
current_api_version The latest stable API version number string

Responses for Folders
Name Description Type
folderkey The folderkey string
name The folder name string
description The description of the folder string
privacy The privacy of the file: 'public' or 'private' string
created The date and time the folder was created string timestamp
revision The revision number of the folder integer
flag The flags associated with the folder bitmask
file_count The amount of files in the folder integer
folder_count The amount of folders in the folder integer
dropbox_enabled Indicates if the folder is FileDrop enabled: 'yes' or 'no' yes/no flag
delete_date The date and time the folder was deleted string timestamp

Responses for Files
Name Description Type
quickkey The quickkey of the file string
hash The hash of the file string
filename The filename string
description The description of the file string
size The size of the file in bytes integer
privacy Indicates the privacy level of the file: 'public' or 'private' string
created The date and time the file was created string timestamp
password_protected Indicates if the file is password protected: 'yes' or 'no' [DEPRECATED] yes/no flag
mimetype The mimetype of the file string
filetype The file type string
view Specifies if this file is viewable via MediaFire and, if so, by what system. 0 [not-viewable], 1 [PDF Viewer], 2 [PDF Viewer], 3 [deprecated]. integer
edit Specifies if this file can be edited via MediaFire and, if so, by what system. 0 [not-editable], 1 [Text Editor], 2 [deprecated]. integer
revision The revision number of the file integer
flag The flags associated with the file bitmask
downloads The amount of times the file has been downloaded integer
views The amount of times the file has been viewed integer
delete_date The date and time the file was deleted string timestamp
view The view link of the file (This response is under the tag "links") string
normal_download The normal download link of the file (This response is under the tag "links") string
watch The watch link of a video file (This response is under the tag "links") string
listen The listen link of a sound file (This response is under the tag "links") string

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:


Example 1(A deleted file with XML):

Request
http://www.mediafire.com/api/1.2/device/get_trash.php?session_token=de8f7c427c7a1e84134175880ca5f7f959a6d2894a47fcc7457ecb65fd930785f72801bc6b2b54be2284baf05a17b4098b47074eff4685259f3a205929e6832ce5e6e9c9affdb3d3
Response
<response>
  <action>device/get_trash</action>
  <name>Trash</name>
  <folder_count>0</folder_count>
  <file_count>3</file_count>
  <chunk_size>100</chunk_size>
  <content_type>files</content_type>
  <chunk_number>1</chunk_number>
  <files>
    <file>
      <quickkey>zwofgsdyae4kadu</quickkey>
      <filename>presentation(3).rtf</filename>
      <description/>
      <size>1564</size>
      <privacy>public</privacy>
      <created>2013-02-18 13:41:30</created>
      <password_protected>no</password_protected>
      <filetype>document</filetype>
      <mimetype>text/rtf</mimetype>
      <flag>22</flag>
      <hash>2288fbc2f2ad7573b5a718c40de5a2052cbc370bd61dc8a875c7990994521191</hash>
      <downloads>0</downloads>
      <views>0</views>
    </file>
    <file>
      <quickkey>bumi3qrvdedun6l</quickkey>
      <filename>test_2013.rtf</filename>
      <description/>
      <size>1559</size>
      <privacy>public</privacy>
      <created>2013-02-18 11:16:50</created>
      <password_protected>no</password_protected>
      <filetype>document</filetype>
      <mimetype>text/rtf</mimetype>
      <flag>22</flag>
      <hash>2fcae6e06f5392a01422b38f916504c13feb2419f64091a696ccc9e2f193267f</hash>
      <downloads>0</downloads>
      <views>0</views>
    </file>
    <file>
      <quickkey>pbj6wh2zbua09uh</quickkey>
      <filename>abc.rtf</filename>
      <description/>
      <size>1564</size>
      <privacy>public</privacy>
      <created>2013-02-18 13:48:18</created>
      <password_protected>no</password_protected>
      <filetype>other</filetype>
      <mimetype>text/rtf</mimetype>
      <flag>2</flag>
      <downloads>0</downloads>
      <views>0</views>
    </file>
  </files>
  <result>Success</result>
  <current_api_version>1.2</current_api_version>
</response>

Example 2 (A deleted file with JSON):
Request
http://www.mediafire.com/api/1.2/device/get_trash.php?content_type=files&session_token=de8f7c427c7a1e84134175880ca5f7f959a6d2894a47fcc7457ecb65fd930785f72801bc6b2b54be2284baf05a17b4098b47074eff4685259f3a205929e6832ce5e6e9c9affdb3d3&response_format=json




Response
{
  "response": {
    "action": "device/get_trash",
    "name": "Trash",
    "folder_count": "0",
    "file_count": "1",
    "chunk_size": "100",
    "content_type": "files",
    "chunk_number": "1",
    "files": [
      {
        "quickkey": "zwofgsdyae4kadu",
        "hash": "d69d65802fc76a90735d90bd097d19d80d093e5b3946a881909bcfef7e38d604",
        "filename": "presentation(3).rtf",
        "size": "1564",
        "privacy": "public",
        "created": "2013-02-18 13:41:30",
        "password_protected": "no",
        "mimetype": "text/rtf",
        "filetype": "document",
        "view": "2",
        "edit": "0",
        "revision": "103108",
        "flag": "22",
        "downloads": "0",
        "views": "0",
        "delete_date": "2014-08-05 17:02:56",
        "links": {
          "view": "http://www.mediafire.com/view/tabw0wn06t601ae/fossa-eating5.jpg",
          "normal_download": "http://www.mediafire.com/file/tabw0wn06t601ae/fossa-eating5.jpg"
        }
      }
    ],
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Get Updates


GET http://www.mediafire.com/api/1.2/device/get_updates.php
POST http://www.mediafire.com/api/1.2/device/get_updates.php

Description : Returns the list of patches for a file that belongs to the session user for a certain revision range. It will also return the current revision number of the file.

Required Parameters:


Relative Parameters:

  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters:

  • target_revision : Specifies the desired target revision of the file. If not passed, the current file revision would be the target revision.
  • response_format : 'xml' or 'json' (default 'xml')


Response Properties

Name Description Type
current_revision The revision number of the file integer
current_hash The hash of the file string
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:

Request
http://www.mediafire.com/api/1.2/device/get_updates.php?session_token=6945fe8378790a36dbc7463646b89521c954a0108ae2085d82ce8d220714c86710931c195fb32584ca59abc07dbc7a70c1844e303ec6e83257b8332950153d3ca8ea23bdb8f99942&quick_key=plga785dlu6bxaq&revision=8
Response
<response>
    <action>device/get_updates</action>
    <current_revision>91</current_revision>
    <updates>
        <update>
            <source_revision>85</source_revision>
            <source_hash>8b757fba0754c3ae6631742fb51add94443d4cc4b3745898c70b33e32b308017</source_hash>
            <target_revision>88</target_revision>
            <target_hash>973ef04268f32a0cff1b4d069b125c78694b3dd357c601d6c6310d73ac75c385</target_hash>
            <timestamp>2013-06-15 22:53:11</timestamp>
        </update>
        <update>
            <source_revision>88</source_revision>
            <source_hash>973ef04268f32a0cff1b4d069b125c78694b3dd357c601d6c6310d73ac75c385</source_hash>
            <target_revision>91</target_revision>
            <target_hash>00df938ff86618903e66857bda65c7ee5b73b3ee3dcf71cc06a195715a737cd9</target_hash>
            <timestamp>2013-06-16 09:15:51</timestamp>
        </update>
    </updates>
    <result>Success</result>
    <current_api_version>1.2</current_api_version>
</response>
Example 2 (Success with JSON):

Request
http://www.mediafire.com/api/device/get_updates.php?quick_key=plga785dlu6bxaq&revision=8&session_token=6945fe8378790a36dbc7463646b89521c954a0108ae2085d82ce8d220714c86710931c195fb32584ca59abc07dbc7a70c1844e303ec6e83257b8332950153d3ca8ea23bdb8f99942&response_format=json
Response
{
  "response": {
    "action": "device/get_updates",
    "current_revision": "91",
    "current_hash": "b30977d7f5db4cc190c2e4db40717ba2cc82473f8bbb5873ed2944bffd4d2eab",
    "updates": [
      {
        "source_revision": "85",
        "source_hash": "8b757fba0754c3ae6631742fb51add94443d4cc4b3745898c70b33e32b308017",
        "target_revision": "88",
        "target_hash": "973ef04268f32a0cff1b4d069b125c78694b3dd357c601d6c6310d73ac75c385",
        "timestamp": "2013-06-15 22:53:11"
      },
      {
        "source_revision": "88",
        "source_hash": "973ef04268f32a0cff1b4d069b125c78694b3dd357c601d6c6310d73ac75c385",
        "target_revision": "91",
        "target_hash": "00df938ff86618903e66857bda65c7ee5b73b3ee3dcf71cc06a195715a737cd9",
        "timestamp": "2013-06-16 09:15:51"
      }
    ],
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Get User Shares


GET http://www.mediafire.com/api/1.2/device/get_user_shares.php
POST http://www.mediafire.com/api/1.2/device/get_user_shares.php

Description : Returns a list of files and folders that you have shared with others.

Required Parameters:


Relative Parameters:

  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters:

  • contacts : Comma-separated list of contact keys by which to filter results (defaults to all contacts).
  • limit : Number of most recent shares to return (defaults to 100).
  • response_format : 'xml' or 'json' (default 'xml')

Response Properties

Name Description Type
contact_key Key of the contact with which the resource was shared string
contact_type ID of the type of the contact integer
contact_indirect Whether the contact is direct (0) or indirect (1). A contact is indirect if you did not directly share your file with them. integer flag
display_name Name or e-mail of the contact string
avatar URI for the contact's avatar image string
resource_key Quickkey or folder key of the shared resource string
attributes Bit 0 = folder; 1 = file bitmask
permissions Bit 0 = read; 1 = read + write; 2 = manage bitmask
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:

Request
http://www.mediafire.com/api/1.2/device/get_user_shares.php?session_token=TOKENcontacts=1234567,7654321&limit=1
Response
<response>
    <action>device/get_user_shares</action>
    <shares>
        <share>
            <contact_key>1234567</contact_key>
            <display_name>Joe Blow</display_name>
            <avatar>URI_FOR_AVATAR_IMAGE</avatar>
            <resource_key>a123b456c7890</resource_key>
            <attributes>2</attributes>
            <permissions>2</permissions>
        </share>
    </shares>
    <result>Success</result>
    <current_api_version>1.2</current_api_version>
</response>
Example 2 (Success with JSON):

Request
http://www.mediafire.com/api/device/get_user_shares.php?contacts=1234567,7654321&limit=1&session_token=6945fe8378790a36dbc7463646b89521c954a0108ae2085d82ce8d220714c86710931c195fb32584ca59abc07dbc7a70c1844e303ec6e83257b8332950153d3ca8ea23bdb8f99942&response_format=json
Response
{
  "response": {
    "action": "device/get_user_shares",
    "shares": [
      {
        "contact_key": "1234567",
        "contact_indirect": "0",
        "resource_key": "a123b456c7890",
        "attributes": "2",
        "permissions": "2",
        "contact_type": "1",
        "display_name": "Joe Blow",
        "avatar": "URI_FOR_AVATAR_IMAGE"
      }
    ],
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Share Resources


GET http://www.mediafire.com/api/1.2/device/share_resources.php
POST http://www.mediafire.com/api/1.2/device/share_resources.php

Description : Share files and/or folders with specified contacts.

Required Parameters:

  • session_token : A type 1 or type 2 session token. (Type 2 will require a call signature).
  • resources : Comma separated list of file or folder keys you wish to share.
  • contacts : Comma separated list of contact keys for whom you wish to share your resources.

Relative Parameters:

  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters:

  • permissions : 1 (default) = read; 2 = read + write; 4 = manage.
  • message : Personal message to display in the share invitation.
  • response_format : 'xml' or 'json' (default 'xml')


Response Properties

Name Description Type
device_revision The revision number of the device
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:

Request
http://www.mediafire.com/api/1.2/device/share_resources.php?session_token=TOKEN&signature=SIGNATURE&resources=QUICKKEY,FOLDERKEY&contacts=1234567,7654321&permissions=2
Response:
<response>
    <action>device/share_resources</action>
    <result>Success</result>
    <current_api_version>1.2</current_api_version>
</response>
Example 2 (Success with JSON):

Request
http://www.mediafire.com/api/device/share_resources.php?resources=uz9u9zqa0tlk6z7,ei1sd03zsets218&contacts=1234567,7654321&permissions=2&session_token=88015ddfeb6b5681a4de1d74d295e9dfb8e5d857e8977e717acac7c8b8edf302b3fa3e9193e24d041b60ead56570e8c6acb94c0497d7fc22479fe4b1af01c9eabc87c209121ae322&response_format=json
Response
{
  "response": {
    "action": "device/share_resources",
    "device_revision": "123",
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Unfollow Resource


GET http://www.mediafire.com/api/1.2/device/unfollow_resource.php
POST http://www.mediafire.com/api/1.2/device/unfollow_resource.php

Description : Revokes the session user's permissions to a resource shared to the session user.

Required Parameters:


Relative Parameters:
  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters:

  • response_format : 'xml' or 'json' (default 'xml')


Response Properties

Name Description Type
device_revision The revision number of the device integer
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:

Request
http://www.mediafire.com/api/1.2/device/unfollow_resource.php?resource=QUICKKEY_OR_FOLDERKEY&session_token=TOKEN&signature=SIGNATURE
Response
<response>
    <action>device/unfollow_resource</action>
    <device_revision>123</device_revision>
    <result>Success</result>
    <current_api_version>1.2</current_api_version>
</response>
Example 2 (Success with JSON):

Request
http://www.mediafire.com/api/device/unfollow_resource.php?resource=uz9u9zqa0tlk6z7&session_token=88015ddfeb6b5681a4de1d74d295e9dfb8e5d857e8977e717acac7c8b8edf302b3fa3e9193e24d041b60ead56570e8c6acb94c0497d7fc22479fe4b1af01c9eabc87c209121ae322&response_format=json
Response
{
  "response": {
    "action": "device/unfollow_resource",
    "device_revision": "123",
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Unshare Resources


GET http://www.mediafire.com/api/1.2/device/unshare_resources.php
POST http://www.mediafire.com/api/1.2/device/unshare_resources.php

Description : Unshares the specified resource with all contacts or one specified contact.

Required Parameters:

Relative Parameters:

  • signature : This is the call signature that is required to authenticate a type 2 session token transaction.

Optional Parameters

  • contact : The user's contact key, which is retrieved from contact/fetch. If not passed, all permissions to the resource for all contacts are revoked.
  • response_format : 'xml' or 'json' (default 'xml')

Response Properties

Name Description Type
device_revision The revision number of the device integer
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Error Codes

To view a list of possible error codes for this API, and their descriptions, click here.



Examples:

Request
http://www.mediafire.com/api/1.2/device/unshare_resources.php?resource=QUICKKEY_OR_FOLDERKEY&session_token=TOKEN&signature=SIGNATURE
Response
<response>
    <action>device/unshare_resources</action>
    <device_revision>123</device_revision>
    <result>Success</result>
    <current_api_version>1.2</current_api_version>
</response>
Example 2 (Success with JSON):

Request
http://www.mediafire.com/api/device/unshare_resources.php?resources=uz9u9zqa0tlk6z7,ei1sd03zsets218&session_token=88015ddfeb6b5681a4de1d74d295e9dfb8e5d857e8977e717acac7c8b8edf302b3fa3e9193e24d041b60ead56570e8c6acb94c0497d7fc22479fe4b1af01c9eabc87c209121ae322&response_format=json
Response
{
  "response": {
    "action": "device/unshare_resources",
    "device_revision": "123",
    "result": "Success",
    "current_api_version": "1.2"
  }
}