Notifications1.4

Get Cache


GET http://www.mediafire.com/api/1.4/notifications/get_cache.php
POST http://www.mediafire.com/api/1.4/notifications/get_cache.php

Notes: New parameter broadcast_class.
New parameter unread_only.

Description : Gets and marks as read a specified number of the most recent cache-only notifications for the current user that matches the specified broadcast_class and decrements the number of unread notifications appropriately.

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:

  • start : Number of records to skip (default 0).
  • limit : Number of records to return (default 100).
  • broadcast_class : The name of the group to get notifications for. Only notifications with with a matching broadcast_class are returned. ""(default).
  • unread_only : Specifies whether only unread notifications should be returned or not. no(default) or yes.
  • response_format : 'xml' or 'json' (default 'xml')


Response Properties

Name Description Type Value
notification An array of notification objects ordered from newest to oldest object
notifications -> actor The key of the contact whose action created the notification string
notifications -> timestamp The date and time the notification was created timestamp string
notifications -> resource The folder or file key that the action was applied to string
notifications -> message The description of the action that took place string
num_older Number of recent notifications integer
error The numerical error code integer
message The error description for the error string
deprecated Indicates this API is deprecated and should no longer be used string
result Indicates if the API call was successful. 'Error' or "Success' string
new_key Indicates a new call signature needs calculated. Applicable only when using Session Token v2 yes/no flag
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 JSON - limit):

Request
HTTPS://www.mediafire.com/api/notifications/get_cache.php?session_token=<token>&limit=5&response_format=json&signature=
Response:
{
   action: notifications/get_cache,
   notifications:[
      {
         actor: 26q5vh6,
         timestamp: 1423701783,
         resource: tip1zg4gbsz4k,
         message: Test 02 made changes to folder "Test 01",
      }
      {
         actor: 26q5vh6,
         timestamp: 1423701767,
         resource: tip1zg4gbsz4k,
         message: Test 02 made changes to folder "Test 01",
      }
      {
         actor: 26q5vh6,
         timestamp: 1423701509,
         resource: 354ziuhvffe29,
         message: Test 02 granted access to folder "Test 001",
      }
      {
         actor: 26q5vh6,
         timestamp: 1423700609,
         resource: tip1zg4gbsz4k,
         message: Test 02 granted access to folder "Test 01",
      }
      {
         actor: 26q5vh6,
         timestamp: 1423700603,
         resource: ,
         message: Test 02 revoked access to folder "Test 01",
      }
   ]
   num_older: 218,
   result: Success,
   new_key: yes,
   current_api_version: 1.4,
}

Example 2 (Success with XML - broadcast_class):

Request
HTTPS://www.mediafire.com/api/1.4/notifications/get_cache.php?session_token=&broadcast_class=test&response_format=xml&signature=
Response:
<action>notifications/get_cache</action>
<notifications>
   <notification>
      <actor>3sfb1ms</actor>
      <timestamp>1431444222</timestamp>
      <resource></resource>
      <broadcast_class>test</broadcast_class>
      <message_template>standard</message_template>
      <message>This is a second message</message>
      <unread>1</unread>
   </notification>
   <notification>
      <actor>3sfb1ms</actor>
      <timestamp>1431444211</timestamp>
      <resource></resource>
      <broadcast_class>test</broadcast_class>
      <message_template>standard</message_template>
      <message>This is a message</message>
      <unread>1</unread>
   </notification>
</notifications>
<num_older>0</num_older>
<result>Success</result>
<new_key>yes</new_key>
<current_api_version>1.4</current_api_version>

Peek Cache


GET http://www.mediafire.com/api/1.4/notifications/peek_cache.php
POST http://www.mediafire.com/api/1.4/notifications/peek_cache.php

Notes: New parameter broadcast_class.

Description : Gets the total number and number of unread cache-only notifications for 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:

  • broadcast_class : The name of the group to get notifications for. Only notifications with with a matching broadcast_class are returned. ""(default).
  • response_format : 'xml' or 'json' (default 'xml')


Response Properties

Name Description Type Value
num_total The total number of notifications in the list integer
num_unread The total number of notifications unread integer
last_timestamp The date and time of the most recently added notification string timestamp
error The numerical error code integer
message The error description for the error string
deprecated Indicates this API is deprecated and should no longer be used string
result Indicates if the API call was successful. 'Error' or "Success' string
new_key Indicates a new call signature needs calculated. Applicable only when using Session Token v2 yes/no flag
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 JSON):

Request
http://www.mediafire.com/api/notifications/peek_cache.php?response_format=json&session_token=0f9bff75f37d132cfe68c4dc25ab0174e0dba329263ea9e5414f181dae67e95cb3c4ccddfe56b43adb7781cf01fe0ec1f16d9d8723af0de326b4e7da47429f928146e90dfb16d8d3
Response:
{
  "response": {
    "action": "notifications/peek_cache",
    "num_total": "27",
    "num_unread": "3",
    "result": "Success",
    "current_api_version": "#CURRENT_API_VERSION#"
  }
}

Example 2 (Success with XML - broadcast_class):

Request
HTTPS://www.mediafire.com/api/1.4/notifications/peek_cache.php?session_token=&broadcast_class=test&response_format=xml&signature=
Response
<action>notifications/peek_cache</action>
<num_total>3</num_total>
<num_unread>1</num_unread>
<last_timestamp>1431444686</last_timestamp>
<result>Success</result>
<new_key>yes</new_key>
<current_api_version>1.4</current_api_version>

Send Message


GET http://www.mediafire.com/api/1.4/notifications/send_message.php
POST http://www.mediafire.com/api/1.4/notifications/send_message.php

Note: This API requires SSL and is restricted. If you wish to enable this feature in your app, please contact customer service.

Description : Sends a message with a list of file and folder keys to one or more non-MediaFire contacts for the purpose of sharing or requesting access to resources.

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:

  • message : A user-specified text message.
  • message_template : Specifies the message template. 'standard' or 'access_request' (default 'standard').
  • response_format : 'xml' or 'json' (default 'xml')


Response Properties

Name Description Type Value
error The numerical error code integer 114
message The error description for the error string
deprecated Indicates this API is deprecated and should no longer be used string
result Indicates if the API call was successful. 'Error' or "Success' string
new_key Indicates a new call signature needs calculated. Applicable only when using Session Token v2 yes/no flag
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.4/notifications/send_message.php?session_token=SESSION_TOKEN
Response
<response>
    <action>notifications/send_message</action>
    <result>Success</result>
    <current_api_version>#CURRENT_API_VERSION#</current_api_version>
</response>

Example 2 (Success with JSON):

Request
http://www.mediafire.com/api/notifications/send_message.php?contact_key=s32y7h54,r54d56g&keys=f04rjb4odlg5w7e,2pfo8n929b9vh7r&response_format=json&session_token=0f9bff75f37d132cfe68c4dc25ab0174e0dba329263ea9e5414f181dae67e95cb3c4ccddfe56b43adb7781cf01fe0ec1f16d9d8723af0de326b4e7da47429f928146e90dfb16d8d3
Response:
{
  "response": {
    "action": "notifications/send_message",
    "result": "Success",
    "current_api_version": "#CURRENT_API_VERSION#"
  }
}

Example 3 (Failure with JSON - Error 114):

Request
HTTPS://www.mediafire.com/api/notifications/send_message.php?session_token=&contact_keys=26q5vh6&keys=8bxs3xl7xk98y46&message=Shared&message_template=standard&response_format=json&signature=
Response
{
   action: notifications/send_message,
   message: Access denied,
   error: 114,
   result: Error,
   new_key: yes,
   current_api_version: 1.3,
}

Send Notification


GET http://www.mediafire.com/api/1.4/notifications/send_notification.php
POST http://www.mediafire.com/api/1.4/notifications/send_notification.php

Note: NEW API
This API requires SSL and is restricted. If you wish to enable this feature in your app, please contact customer service.

Description : Sends a notification to one or more MediaFire contacts optionally including a list of resource keys.

Required Parameters:

  • session_token : A type 1 or type 2 session token. (Type 2 will require a call signature).
  • contact_keys : A comma-separated list of contact keys. Only MediaFire contact types are accepted.
  • message : A user specified text string used as a message.

Relative Parameters:


  • signature : Required only for session token version 2. Click here to learn more about building an API call signature.
  • message_template : Specifies the template to use for the message. When composite is used, a properly formatted JSON message is required (See Composite Messages section below).
  • broadcast_class : The user specified name of the group this notification belongs to.

Optional Parameters:

  • keys : A comma-separated list of quickkeys and folderkeys to include in the notification.
  • response_format : 'xml' or 'json' (default 'xml')

Composite Message:
This is the required structure for a composite message. template, title, subtitle and date are required. The attachments property is required, but may be empty. attachment entries must contain 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
notfications_sent The number of notifications successfully sent integer
error The numerical error code integer
message The error description for the error string
deprecated Indicates this API is deprecated and should no longer be used string
result Indicates if the API call was successful. 'Error' or "Success' string
new_key Indicates a new call signature needs calculated. Applicable only when using Session Token v2 yes/no flag
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 JSON - template=composite):

Request
HTTPS://www.mediafire.com/api/1.4/notifications/send_notification.php?session_token=&contact_keys=kcpag8e&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&message_template=composite&response_format=json&signature=
Response
{
   action: notifications/send_notification,
   notifications_sent: 1,
   result: Success,
   new_key: yes,
   current_api_version: 1.4,
}

Example 2 (Success with XML - broadcast_class and keys):

Request
HTTPS://www.mediafire.com/api/1.4/notifications/send_notification.php?session_token=&contact_keys=kcpag8e%2C6mue12r&message=test%20message&broadcast_class=test&keys=59k1ae6m77hu93u&response_format=xml&signature=
Response:
<action>notifications/send_notification</action>
<notifications_sent>2</notifications_sent>
<result>Success</result>
<new_key>yes</new_key>
<current_api_version>1.4</current_api_version>