Device1.5

Add Device


GET http://www.mediafire.com/api/1.5/device/add_device.php
POST http://www.mediafire.com/api/1.5/device/add_device.php

Notes: This API requires SSL.

Description : Add the calling device to the user's account. This call will return a device token. This token has to be saved locally in the device to be used for all device management calls.

Required Parameters:

  • session_token : A type 1 or type 2 session token. (Type 2 will require a call signature).
  • device_type : The device type to be added. desktop-windows, desktop-mac, mobile-iphone, mobile-android, tablet-ipad.

Relative Parameters:

  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

  • display_name : The name of the device. If not passed, a new name will be generated.
  • push_token : The token from an external service(iPhone, Android) to be used to push messages to this device.
  • response_format : 'xml' or 'json' (default 'xml')


Response Properties

Name Description Type Values
device_id The numeric ID of the device integer
device_token The protected token of the device string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Error Codes

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



Examples:

Example 1:(Success with JSON)
Request
HTTPS://www.mediafire.com/api/1.5/device/add_device.php?session_token=&device_type=mobile-android&display_name=Android001&push_token=&response_format=json&signature=
Response
{
   action: device/add_device,
   device:{
      device_id: 13,
      device_token: kblzyr7hbbt100lfthwpe63udow20296sh6907h5,
   }
   result: Success,
   new_key: yes,
   current_api_version: 1.3,
}

Empty Trash


GET http://www.mediafire.com/api/1.5/device/empty_trash.php
POST http://www.mediafire.com/api/1.5/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 : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

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


Response Properties

Name Description Type Values
asynchronous Specifies whether the purge is being processed asynchronously. If yes, poll device/get_status to determine when the job is complete flag no/yes
device_revision The new revision number of the device string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

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

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

Follow Resource


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

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

Required Parameters:


Relative Parameters:

  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

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


Response Properties

Name Description Type Values
new_device_revision The new revision number of the device string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 114, 128, 236
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

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.5/device/follow_resource.php?resource=QUICKKEY_OR_FOLDERKEY&session_token=TOKEN&signature=SIGNATURE
Response
<response>
    <action>device/follow_resource</action>
    <new_device_revision>123</device_revision>
    <result>Success</result>
    <current_api_version>1.5</current_api_version>
</response>

Example 2 (Failure with JSON - Error 114):

Request
HTTPS://www.mediafire.com/api/1.5/device/follow_resource.php?session_token=&resource=8se6p55ybmbl9c0&response_format=json&signature=
Response
{
   action: device/follow_resource,
   message: Access denied,
   error: 114,
   result: Error,
   new_key: yes,
   current_api_version: 1.5,
}

Example 2 (Failure with XML - Error 236):

Request
HTTPS://www.mediafire.com/api/1.5/device/follow_resource.php?session_token=&resource=8se6p55ybmbl9c0&response_format=json&signature=
Response
<action>device/follow_resource</action>
<message>You already follow this resource</message>
<error>236</error>
<result>Error</result>
<new_key>yes</new_key>
<current_api_version>1.5</current_api_version>

Get Changes


GET http://www.mediafire.com/api/1.5/device/get_changes.php
POST http://www.mediafire.com/api/1.5/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 : Required only for session token version 2. Click here to learn more about building an API call signature.

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 Value
new_device_revision The new revision number of the device string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 128, 141
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Returned responses for updated files
Name Description Type Value
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 string application, archive, audio, development, data, document, image, presentation, spreadsheet, video
revision The revision number of the updated file integer
created The date and time the file was created string timestamp
parent_folderkey The ID of the folder containing this folder or file string
parent_foldername The parent foldername of the updated file string

Returned responses for updated folders
Name Description Type Value
folderkey The folderkey for the updated folder string
revision The revision number of the updated folder integer
parent_folderkey The parent folderkey of the updated folder string

Returned responses for deleted files
Name Description Type Value
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
parent_folderkey The parent folderkey of the deleted file string

Returned responses for deleted folders
Name Description Type Value
folderkey The folderkey for the deleted folder string
revision The revision number of the deleted folder integer
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(Success with XML showing changes):

Request
http://www.mediafire.com/api/1.5/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.5</current_api_version>
</response>

Example 2 (A Response Showing No Changes with JSON):

Request
HTTPS://www.mediafire.com/api/1.0/device/get_changes.php?&session_token=&revision=160408&response_format=json&signature=
Response
{
   action: device/get_changes,
   updated:{
      files: ,
      folders: ,
   }
   deleted:{
      files: ,
      folders: ,
   }
   device_revision: 161072,
   changes_list_block: 500,
   result: Success,
   new_key: yes,
   current_api_version: 1.5,
}

Example 3 (Failure with XML - Error 128):
Request
HTTPS://www.mediafire.com/api/1.0/device/get_changes.php?&session_token=&response_format=xml&signature=
Response
<action>device/get_changes</action>
<message>Required parameters for this request are missing</message>
<error>128</error>
<result>Error</result>
<new_key>yes</new_key>
<current_api_version>1.5</current_api_version>

Get Foreign Changes


GET http://www.mediafire.com/api/1.5/device/get_foreign_changes.php
POST http://www.mediafire.com/api/1.5/device/get_foreign_changes.php

Description : Returns a list of all shared resources from a user's contact with recent changes since 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).
  • contact_key: The ID key of a contact that shared resources with the session user..
  • revision : The device revision after which the changes to be returned occur.

Relative Parameters:

  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

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 Value
quickkey The ID key of the file string
filename The name of the file string
mimetype The MIME type of the file string
filetype The type of the file string application, archive, audio, development, data, document, image, presentation, spreadsheet, video
revision The revision number of the folder or file integer
created The date and time the file was created datetime string
parent_folderkey The ID of the folder containing this folder or file string
parent_foldername The name of the folder where the file resides string
privacy Specifies whether the folder or file is publicly accessible or not. string public, private
permissions Indicated which 500 block was Specifies the user's permissions to the shared folder or file specified for the call string '1'=read, '2'=read+write
options string
folder_key The ID key of the folder string
changes_list_block Indicated the size of the returned blocks (currently 500). integer
new_device_revision The new revision number of the device string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 100, 128, 138
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Error Codes

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



Examples:


Example 1(Success with changes - JSON):

Request
HTTPS://www.mediafire.com/api/device/get_foreign_changes.php?session_token=&contact_key=1h3fyzg&revision=966&response_format=xml&signature=
Response
<action>device/get_foreign_changes</action>
<updated>
   <files>
      <file>
         <quickkey>4e7789qeab9f8mc</quickkey>
         <filename>Getting Started with MediaFire.pdf</filename>
         <mimetype>application/pdf</mimetype>
         <filetype>document</filetype>
         <revision>967</revision>
         <created>2014-09-16 15:00:48</created>
         <grafted>no</grafted>
         <parent_folderkey></parent_folderkey>
         <privacy>public</privacy>
         <parent_foldername></parent_foldername>
         <share>
            <permissions>1</permissions>
            <options>0</options>
         </share>
      </file>
   </files>
   <folders>
      <folder>
         <folderkey>8qkxzxu31sqe5</folderkey>
         <revision>979</revision>
         <grafted>no</grafted>
         <parent_folderkey></parent_folderkey>
         <privacy>public</privacy>
         <share>
            <permissions>2</permissions>
            <options>0</options>
         </share>
      </folder>
   </folders>
</updated>
<deleted>
   <files></files>
   <folders></folders>
</deleted>
<device_revision>980</device_revision>
<changes_list_block>500</changes_list_block>
<result>Success</result>
<new_key>yes</new_key>
<current_api_version>1.5</current_api_version>

Example 2 (Failure with JSON - Error 138):

Request
HTTPS://www.mediafire.com/api/device/get_foreign_changes.php?session_token=&contact_key=1h3fyzt&revision=966&response_format=json&signature=
Response
{
   action: device/get_foreign_changes,
   message: This contact does not exist,
   error: 138,
   result: Error,
   new_key: yes,
   current_api_version: 1.5,
}

Example 3 (A response showing no changes with JSON):
Request
http://www.mediafire.com/api/1.5/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.5"
  }
}

Get Foreign Resources


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

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

Required Parameters:


Relative Parameters:

  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

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 Value
new_device_revision The new revision number of the device string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 128
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Responses for Files
Name Description Type Value
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. flag yes, no
filetype The filetype: 'presentation,' 'spreadsheet,' 'image,' 'document,' etc. string application, archive, audio, development, data, document, image, presentation, spreadsheet, video
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 0(Not Viewable), 1(PDF2HTMLex), 2(Syntax Highlighting), 3(PHP Excel), 4(AbiWord), 5(PDF2HTMLex with GS PDF Split), 6(PlainText), 7(Image Gallery), 9(Web Player Audio), 10(Web Player Audio with Transcode), 11(JPlayer Video), 12(JPlayer Video with Transcode)
edit Specifies if this file can be edited via MediaFire and, if so, by what system. integer 0 [not-editable], 1 [Text Editor], 2 [deprecated].
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. bitmask 0 = read; 1 = read + write; 2 = manage
options Information about the file. Bits not listed in the values column are for internal MediaFire documentation and not for public distribution bitmask 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 Value
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. 'yes' (private) or 'no' for share link is enabled (public) flag yes,no
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

Error Codes

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



Examples:


Example 1(Success with JSON):

Request
HTTPS://www.mediafire.com/api/1.5/device/get_foreign_resources.php?session_token=&response_format=json&signature=
Response
{
   action: device/get_foreign_resources,
   files:[
      {
         md5: faa409d0793cdc6b2c59d0d2a6033fbe94604c4a0fba2ec3cb81b6d361363cb6,
         quickkey: 450gfl6ez0g4i56,
         filename: Getting Started with MediaFire.pdf,
         created: 2015-04-14 13:21:29,
         desc: ,
         revision: 23,
         size: 13108214,
         mimetype: application/pdf,
         share_link_enabled: no,
         filetype: document,
         view: 1,
         edit: 0,
         hash: faa409d0793cdc6b2c59d0d2a6033fbe94604c4a0fba2ec3cb81b6d361363cb6,
         date_shared: 2015-04-30 10:06:12,
         resource_key: 450gfl6ez0g4i56,
         attributes: 2,
         permissions: 1,
         options: 0,
         sharer: 3rjq59b,
      }
      {
         md5: 9336396d039d29899898ba6d3c9035e2371d3d7d572317517761fd5208912c25,
         quickkey: 7i3m3xyjgb4un5l,
         filename: Sample - Cherry Blossoms.jpg,
         created: 2014-09-16 15:00:47,
         desc: Cherry Blossoms by Jeff Kubina http://www.flickr.com/photos/kubina/448485266/,
         revision: 1119,
         size: 2207340,
         mimetype: image/jpeg,
         share_link_enabled: yes,
         filetype: image,
         view: 2,
         edit: 0,
         hash: 9336396d039d29899898ba6d3c9035e2371d3d7d572317517761fd5208912c25,
         date_shared: 2015-04-29 14:12:38,
         resource_key: 7i3m3xyjgb4un5l,
         attributes: 2,
         permissions: 2,
         options: 0,
         sharer: gz0vu5z,
      }
   ]
   folders:[
      {
         name: Documents,
         desc: ,
         created: 2015-04-14 13:21:29,
         folderkey: eydl3ix0gi8ue,
         revision: 24,
         share_link_enabled: yes,
         date_shared: 2015-04-30 10:13:23,
         resource_key: eydl3ix0gi8ue,
         attributes: 1,
         permissions: 2,
         options: 0,
         sharer: 3rjq59b,
      }
   ]
   result: Success,
   new_key: yes,
   current_api_version: 1.5,
}
Example 2 (Success with XML - contact):
Request
HTTPS://www.mediafire.com/api/1.5/device/get_foreign_resources.php?session_token=&contact=3rjq59b&response_format=xml&signature=
Response
<action>device/get_foreign_resources</action>
<files>
   <file>
      <md5>faa409d0793cdc6b2c59d0d2a6033fbe94604c4a0fba2ec3cb81b6d361363cb6</md5>
      <quickkey>450gfl6ez0g4i56</quickkey>
      <filename>Getting Started with MediaFire.pdf</filename>
      <created>2015-04-14 13:21:29</created>
      <desc></desc>
      <revision>23</revision>
      <size>13108214</size>
      <mimetype>application/pdf</mimetype>
      <share_link_enabled>no</share_link_enabled>
      <filetype>document</filetype>
      <view>1</view>
      <edit>0</edit>
      <hash>faa409d0793cdc6b2c59d0d2a6033fbe94604c4a0fba2ec3cb81b6d361363cb6</hash>
      <date_shared>2015-04-30 10:06:12</date_shared>
      <resource_key>450gfl6ez0g4i56</resource_key>
      <attributes>2</attributes>
      <permissions>1</permissions>
      <options>0</options>
      <sharer>3rjq59b</sharer>
   </file>
</files>
<folders>
   <folder>
      <name>Documents</name>
      <desc></desc>
      <created>2015-04-14 13:21:29</created>
      <folderkey>eydl3ix0gi8ue</folderkey>
      <revision>24</revision>
      <share_link_enabled>yes</share_link_enabled>
      <date_shared>2015-04-30 10:13:23</date_shared>
      <resource_key>eydl3ix0gi8ue</resource_key>
      <attributes>1</attributes>
      <permissions>2</permissions>
      <options>0</options>
      <sharer>3rjq59b</sharer>
   </folder>
</folders>
<result>Success</result>
<new_key>yes</new_key>
<current_api_version>1.5</current_api_version>

Get Patch


GET http://www.mediafire.com/api/1.5/device/get_patch.php
POST http://www.mediafire.com/api/1.5/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 : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

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


Response Properties

Name Description Type Value
patch_link The download URL of the patch file string
patch_hash The hash of the patch file string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 128, 222
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

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
HTTPS://www.mediafire.com/api/device/get_patch.php?session_token=&quick_key=m5n80esjby77mq4&source_revision=155395&target_revision=155397&response_format=xml&signature=
Response
<action>device/get_patch</action>
<patch_link>http://download1485.mediafire.com/w3a8umtnupxg/m5n80esjby77mq4/test0.txt.patch.155395.155397</patch_link>
<patch_hash>c78034fa662f18d4e635e8957267be082d5a4aea4f1de8a61bf1e9a3756c0e7a</patch_hash>
<result>Success</result>
<new_key>yes</new_key>
<current_api_version>1.3</current_api_version>

Example 2(Failure with JSON - Error 222):

Request
HTTPS://www.mediafire.com/api/device/get_patch.php?session_token=&quick_key=m5n80esjby77mq4&source_revision=155396&target_revision=155397&response_format=json&signature=
Response
{
   action: device/get_patch,
   message: The requested patch was not found or unknown,
   error: 222,
   result: Error,
   new_key: yes,
   current_api_version: 1.3,
}

Get Resource Shares


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

Description : Returns a list of contacts, along with their permissions, that a file or folder resource has been shared to.

Required Parameters:


Relative Parameters:

  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

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

Response Properties

Name Description Type Value
contact_key Key representing a user relationship, found in lr_contacts.contacts string
contact_type The type of the contact string mediafire, facebook, gmail, twitter, sms
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. flag 0, 1
display_name Name or e-mail of the contact string
avatar URI for the contact's avatar image string
permissions The contact's permission level bitmask 1(read), 2(read+write)
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 128
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

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.5/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.5</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.5"
  }
}

Get Status


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

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

Required Parameters:


Relative Parameters:
  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

  • device_id : The ID of the device. If not passed, it would return the status of the cloud device.
  • simple_report : Omits async_jobs_in_progress and async_job_types from the response. no(default) or yes.
  • response_format : 'xml' or 'json' (default 'xml')


Response Properties

Name Description Type Value
device_revision The new revision number of the device integer
async_jobs_in_progress Indicates whether the user has asynchronous jobs running on the back-end. 'yes' or 'no' flag yes, no
async_job_types A collection of the different async job types being run on the account object Copy, Delete, Restore, Purge
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Error Codes

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



Examples:

Example 1 (Success with JSON - simple_report=no):
Request
HTTPS://www.mediafire.com/api/1.5/device/get_status.php?session_token=&simple_report=no&response_format=json&signature=
Response
{
   action: device/get_status,
   device_revision: 162505,
   async_jobs_in_progress: yes,
   async_job_types:[
      Delete,
   ]
   result: Success,
   new_key: yes,
   current_api_version: 1.3,
}

Example 2 (Success with XML - simple_report=yes):

Request
HTTPS://www.mediafire.com/api/1.5/device/get_status.php?session_token=&simple_report=yes&response_format=xml&signature=
Response
<action>device/get_status</action>
<device_revision>162617</device_revision>
<result>Success</result>
<new_key>yes</new_key>
<current_api_version>1.3</current_api_version>

Get Trash


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

Notes: 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 not 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 : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

  • device_id : The ID of the device. If not passed, it would return files and folders from '0' (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 system will return results in chunks, or groups, of 100. You can specify which chunk of results to return. For example, 'chunk=1' will return 1-100 of the trash results. 'chunk=2' would return 101-200, and so forth.
  • response_format : 'xml' or 'json' (default 'xml')

Response Properties

Name Description Type Value
name The folder name string
folder_count The amount of folders in the user's trash integer
file_count The amount of files in the user's trash integer
chunk_size The number of items returned in a single chunk. integer
content_type The type of content requested string folder, file
chunk_number The chunk number integer
new_device_revision The new revision number of the device string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Responses for Folders
Name Description Type Value
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' flag yes, no
delete_date The date and time the folder was deleted string timestamp

Responses for Files
Name Description Type Value
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 pubic, private
created The date and time the file was created string timestamp
password_protected Indicates if the file is password protected: 'yes' or 'no' [DEPRECATED] flag yes, no
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. integer 0(Not Viewable, 1(PDF2HTMLex), 2(Syntax Highlighting), 3(PHP Excel), 4(AbiWord), 5(PDF2HTMLex with GS PDF Split), 6(PlainText), 7(Image Gallery), 8(deprecated], 9(JPlayer Audio), 10(JPlayer Audio with Transcode), 11(JPlayer Video), 12(JPlayer Video with Transcode)
edit Specifies if this file can be edited via MediaFire and, if so, by what system. integer 0 [not-editable], 1 [Text Editor], 2 [deprecated]
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
edit The edit 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(Success with JSON - data_only=no and content_type=folders):

Request
HTTPS://www.mediafire.com/api/1.0/device/get_trash.php?&session_token=&data_only=no&content_type=folders&response_format=json&signature=
Response
{
   action: device/get_trash,
   name: Trash,
   folder_count: 1,
   file_count: 1,
   chunk_size: 100,
   content_type: folders,
   chunk_number: 1,
   folders:[
      {
         folderkey: qe8aj48d0zys3,
         name: Test 001,
         description: ,
         privacy: private,
         created: 2015-04-08 12:52:25,
         revision: 161075,
         flag: 2,
         file_count: 0,
         folder_count: 1,
         dropbox_enabled: no,
         delete_date: 2015-04-08 12:52:36,
      }
   ]
   result: Success,
   new_key: yes,
   current_api_version: 1.5,
}

Example 2 (Success with XML - data_only=no and content_type=files):
Request
HTTPS://www.mediafire.com/api/1.0/device/get_trash.php?&session_token=&data_only=no&content_type=files&response_format=xml&signature=
Response
<action>device/get_trash</action>
<name>Trash</name>
<folder_count>1</folder_count>
<file_count>1</file_count>
<chunk_size>100</chunk_size>
<content_type>files</content_type>
<chunk_number>1</chunk_number>
<files>
   <file>
      <quickkey>qjhdr9re27d0cl8</quickkey>
      <hash>6c179f21e6f62b629055d8ab40f454ed02e48b68563913473b857d3638e23b28</hash>
      <filename>Untitled.txt</filename>
      <description></description>
      <size>2</size>
      <privacy>private</privacy>
      <created>2015-04-08 12:52:30</created>
      <password_protected>no</password_protected>
      <mimetype>text/plain</mimetype>
      <filetype>document</filetype>
      <view>1</view>
      <edit>1</edit>
      <revision>161076</revision>
      <flag>22</flag>
      <downloads>0</downloads>
      <views>0</views>
      <delete_date>2015-04-08 12:52:36</delete_date>
      <links>
         <view>http://sandbox.mediafire.com/view/qjhdr9re27d0cl8/Untitled.txt</view>
         <edit>http://sandbox.mediafire.com/edit/qjhdr9re27d0cl8/Untitled.txt</edit>
         <normal_download>http://sandbox.mediafire.com/file/qjhdr9re27d0cl8/Untitled.txt</normal_download>
      </links>
   </file>
</files>
<result>Success</result>
<new_key>yes</new_key>
<current_api_version>1.5</current_api_version>

Example 3 (Success with XML - data_only=yes):
Request
HTTPS://www.mediafire.com/api/1.0/device/get_trash.php?&session_token=&data_only=yes&response_format=xml&signature=
Response
<action>device/get_trash</action>
<name>Trash</name>
<folder_count>1</folder_count>
<file_count>1</file_count>
<result>Success</result>
<new_key>yes</new_key>
<current_api_version>1.5</current_api_version>

Get Updates


GET http://www.mediafire.com/api/1.5/device/get_updates.php
POST http://www.mediafire.com/api/1.5/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 : Required only for session token version 2. Click here to learn more about building an API call signature.

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 Value
current_revision The revision number of the file integer
current_hash The hash of the file string
source_revision The file's revision number before it was modified integer
source_hash The MD5 or SHA256 hash of the file before it was modified string
target_revision The file's revision number after it was modified integer
target_hash The MD5 or SHA256 hash of the file after it was modified string
patch_hash string
timestamp The date and time the file modification took place string timestamp
deprecated Indicates this API is deprecated and should no longer be used string yes
error The numerical error code integer 110, 129
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

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.5/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.5</current_api_version>
</response>
Example 2 (Failure with JSON - Error 110):

Request
HTTPS://www.mediafire.com/api/device/get_updates.php?session_token=&quick_key=m5n80esjby77rq4&revision=155399&response_format=json&signature=
Response
{
   action: device/get_updates,
   message: Unknown or Invalid QuickKey,
   error: 110,
   result: Error,
   new_key: yes,
   current_api_version: 1.5,
}

Example 3 (Failure with JSON - Error 129

Request
HTTPS://www.mediafire.com/api/device/get_updates.php?session_token=&quick_key=iisverdpyrfih&revision=155399&response_format=json&signature=
Response
{
   action: device/get_updates,
   message: One or more parameters for this request are invalid,
   error: 129,
   result: Error,
   current_api_version: 1.5,
}

Get User Shares


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

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

Required Parameters:


Relative Parameters:

  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

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 Value
contact_key Key of the contact with which the resource was shared string
resource_key Quickkey or folder key of the shared resource string
attributes The resource type bitmask 0 = folder; 1 = file
permissions Designates the user's permission level for the shared resource bitmask 0 = read; 1 = read + write; 2 = manage
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 0 (direct) 1 (indirect)
contact_type ID of the type of the contact string mediafire, facebook, gmail, twitter, sms
display_name Name or e-mail of the contact string
avatar URI for the contact's avatar image string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Error Codes

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



Examples:

Example 1(Success with JSON):
Request
HTTPS://www.mediafire.com/api/device/get_user_shares.php?session_token=&response_format=json&signature=
Response
{
   action: device/get_user_shares,
   shares:[
      {
         contact_key: 873mzs8,
         resource_key: ht2uk4cbri46iud,
         attributes: 2,
         permissions: 1,
         contact_indirect: 0,
         contact_type: 1,
         display_name: Test 01,
         avatar: https://www.mediafire.com/images/icons/myfiles/default.png,
      }
      {
         contact_key: 64t95rv,
         resource_key: ht2uk4cbri46iud,
         attributes: 2,
         permissions: 2,
         contact_indirect: 0,
         contact_type: 6,
         display_name: Test03@g.n,
         avatar: https://www.mediafire.com/images/icons/myfiles/default.png,
      }
      {
         contact_key: 71gp532,
         resource_key: uyy4dbvr4tu4gvp,
         attributes: 2,
         permissions: 2,
         contact_indirect: 0,
         contact_type: 1,
         display_name: Shade,
         avatar: http://www1.mediafire.com/convkey/05e3/qi2i5wi7pddhwfo1g.jpg,
      }
      {
         contact_key: kq4iukc,
         resource_key: uyy4dbvr4tu4gvp,
         attributes: 2,
         permissions: 2,
         contact_indirect: 1,
         contact_type: 1,
         display_name: test 77,
         avatar: http://www.mediafire.com/images/icons/myfiles/default.png,
      }
   ]
   result: Success,
   new_key: yes,
   current_api_version: 1.5,
}
Example 2 (Success with XML - limit=2):

Request
HTTPS://www.mediafire.com/api/device/get_user_shares.php?session_token=&limit=2&response_format=xml&signature=
Response
<action>device/get_user_shares</action>
<shares>
   <share>
      <contact_key>873mzs8</contact_key>
      <resource_key>ht2uk4cbri46iud</resource_key>
      <attributes>2</attributes>
      <permissions>1</permissions>
      <contact_indirect>0</contact_indirect>
      <contact_type>1</contact_type>
      <display_name>Test 01</display_name>
      <avatar>https://www.mediafire.com/images/icons/myfiles/default.png</avatar>
   </share>
   <share>
      <contact_key>64t95rv</contact_key>
      <resource_key>ht2uk4cbri46iud</resource_key>
      <attributes>2</attributes>
      <permissions>2</permissions>
      <contact_indirect>0</contact_indirect>
      <contact_type>6</contact_type>
      <display_name>Test03@g.n</display_name>
      <avatar>https://www.mediafire.com/images/icons/myfiles/default.png</avatar>
   </share>
</shares>
<result>Success</result>
<new_key>yes</new_key>
<current_api_version>1.5</current_api_version>

Remove Device


GET http://www.mediafire.com/api/1.5/device/remove_device.php
POST http://www.mediafire.com/api/1.5/device/remove_device.php

Description : Remove a device from the user's account.

Required Parameters:

  • session_token : A type 1 or type 2 session token. (Type 2 will require a call signature).
  • device_token : The protected token for a device.
  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

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


Response Properties

Name Description Type Values
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Error Codes

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



Examples:

Example 1:(Success with JSON)
Request
HTTPS://www.mediafire.com/api/1.5/device/remove_device.php?session_token=&device_token=&response_format=json&signature=
Response
{
   action: device/remove_device,
   result: Success,
   new_key: yes,
   current_api_version: 1.3,
}

Request Foreign Resource


GET http://www.mediafire.com/api/1.5/device/request_foreign_resource.php
POST http://www.mediafire.com/api/1.5/device/request_foreign_resource.php

Description : Requests access to the specified file or folder.

Required Parameters:


Relative Parameters:

  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

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


Response Properties

Name Description Type Value
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 234
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

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/device/request_foreign_resource.php?resource=uz9u9zqa0tlk6z7&session_token=
Response
<action>device/request_foreign_resource</action>
<result>Success</result>
<current_api_version>1.0</current_api_version>
Example 2 (Failure with XML - Error 234):
Request
HTTPS://www.mediafire.com/api/device/request_foreign_resource.php?session_token=&resource=l6bhn7hxl67hojn&response_format=xml&signature=
Response
<action>device/request_foreign_resource</action>
<message>Failed to send message</message>
<error>234</error>
<result>Error</result>
<new_key>yes</new_key>
<current_api_version>1.5</current_api_version>

Share Resources


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

Notes: New property pushNotification in composite message object.

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:

  • broadcast_class : The user specified name of the group this notification belongs to. Required if message is passed.
  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

  • send_notification : Specifies whether this API should send share messages and notifications to the contacts. no or yes(default).
  • permissions : [NOT IN USE] 1 (default) = read; 2 = read + write; 4 = manage.
  • message : The custom composite message to use for notifications sent by this API.
  • response_format : 'xml' or 'json' (default 'xml')


Composite Messages

Composite message array in JSON format. Properties template, title, subtitle, date, attachments are required. attachments may be an empty array. attachments entries must contain properties quickkey and base64Binary which, in turn, must contain a valid BASE64 encoded string. This example is formatted for readability so spacing should be removed.
{
    "template": "template",
    "title": "Aperiam oblique senserit",
    "subtitle": "Quo movet appellantur delicatissimi an. Dicat facer audiam vim at.",
    "date": "02-04-2015",
    "attachments": [
        {
            "base64Binary": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAQCAwMDAgQDAwMEBAQEBQkGBQUFBQsICAYJDQsNDQ0LDAw... ",
            "quickkey": "8pof4o222d6uz28"
        },
        {
            "base64Binary": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAQCAwMDAgQDAwMEBAQEBQkGBQUFBQsICAYJDQsNDQ0LDAw... ",
            "quickkey": "8pof4o111d6uz28"
        },
        {
            "base64Binary": "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAQCAwMDAgQDAwMEBAQEBQkGBQUFBQsICAYJDQsNDQ0LDAw... ",
            "quickkey": "8pof4o333d6uz28"
        }
    ]
}

Response Properties

Name Description Type Value
new_device_revision The new revision number of the device string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 138, 240
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Error Codes

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



Examples:

Example 1 (Success with XML - send_notification=yes, message and broadcast_class):
Request
HTTPS://www.mediafire.com/api/1.5/device/share_resources.php?session_token=&resources=d0m3i8zdmtc7193%2C1yjt72psq5ne2ma&contacts=3sfb1ms%2Cvne9byv&broadcast_class=testtool&permissions=2&send_notification=yes&message=%7B%22template%22%3A%22template%22%2C%22title%22%3A%22Aperiam%20oblique%20senserit%22%2C%22subtitle%22%3A%22Quo%20movet%20appellantur%20delicatissimi%20an.%20Dicat%20facer%20audiam%20vim%20at.%22%2C%22date%22%3A%2202-04-2015%22%2C%22attachments%22%3A%5B%5D%7D&response_format=xml&signature=
Response:
<action>device/share_resources</action>
<result>Success</result>
<new_key>yes</new_key>
<current_api_version>1.3</current_api_version>
<new_device_revision>162630</new_device_revision>
Example 2 (Failure with XML - Error 138):

Request
HTTPS://www.mediafire.com/api/1.5/device/share_resources.php?session_token=&resources=rra6c0loi1aet6l&contacts=8rjq69b&response_format=xml&signature=
Response
<action>device/share_resources</action>
<message>This contact does not exist</message>
<error>138</error>
<result>Error</result>
<new_key>yes</new_key>
<current_api_version>1.5</current_api_version>

Example 3 (Failure with JSON - Error 240):

Request
HTTPS://www.mediafire.com/api/1.5/device/share_resources.php?session_token=&resources=rra6c0lo11aet6l&contacts=3rjq59b&response_format=json&signature=
Response
{
   action: device/share_resources,
   message: Cannot grant permissions to the specified resource(s),
   error: 240,
   result: Error,
   new_key: yes,
   current_api_version: 1.5,
}


Unfollow Resource


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

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

Required Parameters:


Relative Parameters:
  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters:

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


Response Properties

Name Description Type Value
new_device_revision The new revision number of the device string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 114, 237
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Error Codes

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



Examples:

Example 1(Success with JSON):
Request
HTTPS://www.mediafire.com/api/1.5/device/unfollow_resource.php?session_token=&resource=eydl3ix0gi8ue&response_format=json&signature=
Response
{
   action: device/unfollow_resource,
   result: Success,
   new_key: yes,
   current_api_version: 1.5,
   new_device_revision: 27,
}
Example 2 (Failure with JSON - Error 237):

Request
HTTPS://www.mediafire.com/api/1.5/device/unfollow_resource.php?session_token=&resource=8se6p55ybmbl9c0&response_format=json&signature=
Response
{
   action: device/unfollow_resource,
   message: You are not following this resource,
   error: 237,
   result: Error,
   new_key: yes,
   current_api_version: 1.5,
}

Unshare Resources


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

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

Required Parameters:

Relative Parameters:

  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.

Optional Parameters

  • send_notification : Specifies whether this API should send unshare messages and notifications to the contacts the resource was shared to. no or yes(default).
  • 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 Value
new_device_revision The new revision number of the device string
deprecated Indicates this API is deprecated and should no longer be used. string yes
error The numerical error code integer 110, 138
message The description of the error string
result Indicates if the API call was successful: 'Success' or 'Error' string Success, Error
current_api_version The latest stable API version number string
new_key Indicates a new call signature needs to be calculated. Applicable only when using Session Token v2 string yes

Error Codes

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



Examples:

Example 1 (Success with JSON - send_notification=yes):
Request
HTTPS://www.mediafire.com/api/1.5/device/unshare_resources.php?session_token=&resources=d0m3i8zdmtc7193&send_notification=yes&response_format=json&signature=
Response
{
   action: device/unshare_resources,
   result: Success,
   new_key: yes,
   current_api_version: 1.3,
   new_device_revision: 162631,
}
Example 2 (Success with JSON - send_notification=no):

Request
HTTPS://www.mediafire.com/api/1.5/device/unshare_resources.php?session_token=&resources=1yjt72psq5ne2ma&send_notification=no&response_format=json&signature=
Response
{
   action: device/unshare_resources,
   result: Success,
   new_key: yes,
   current_api_version: 1.3,
   new_device_revision: 162632,
}