Contact1.2

Add


GET http://www.mediafire.com/api/1.2/contact/add.php
POST http://www.mediafire.com/api/1.2/contact/add.php

Description : Adds a new contact, updates an existing contact, or imports/syncs a third-party contact to the current session user's contact list.

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')
  • contact_type : Indicates the contact type to be added ("mediafire", "facebook", "gmail", "twitter"...). If not set, then it will be left blank.
  • contact_key : Specifies an existing contact. If provided, the specified contact details will be added to this contact. If unset, then a new contact will be created. **IMPORTANT NOTE** 'source_uid' MUST BE SUPPLIED IF USING A CONTACTKEY.
  • display_name : The display name of the contact to be added.
  • first_name : The first name of the contact to be added.
  • last_name : The last name of the contact to be added.
  • avatar : The URL to the picture/icon of the contact.
  • source_uid : The user ID (MediaFire, Facebook, Twitter...) of the contact to be added.
  • email : The email address of the contact to be added.
  • phone : The phone number (xxx-xxx-xxxx) of the contact to be added.
  • birthdate : The date of birth (yyyy-mm-dd) of the contact to be added.
  • location : The location (city, state, country) of the contact to be added.
  • gender : The gender of the contact to be added. 1 = female, 2 = male.
  • website : The URL of the contact's website.
  • response_format : 'xml' or 'json' (default 'xml')

Response Properties

Name Description Type
contact_keys The contact key(s) of the added (or updated) contact(s) comma-delimited list
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/contact/add.php?session_token=749e4610d9e719620a1e9347ca9aabe5f86ac58d67c8bdd85f0eb4e043624ac70ec1a3f88dd49bb8126ad4c38a7686665ec66d727207ac1a99e9dc6c5cdf0772da405c3464c2d2af&contact_type=mediafire&display_name=TEST4&email=test4@gmail.com
                        
Response
<response>
  <action>contact/add</action>
  <result>Success</result>
  <current_api_version>1.2</current_api_version>
</response>
JSON Example
Request
http://www.mediafire.com/api/contact/add.php?contact_type=mediafire&display_name=TEST4&email=test4@gmail.com&session_token=749e4610d9e719620a1e9347ca9aabe5f86ac58d67c8bdd85f0eb4e043624ac70ec1a3f88dd49bb8126ad4c38a7686665ec66d727207ac1a99e9dc6c5cdf0772da405c3464c2d2af&response_format=json

                        
Response
{
  "response": {
    "action": "contact/add",
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Delete


GET http://www.mediafire.com/api/1.2/contact/fetch.php
POST http://www.mediafire.com/api/1.2/contact/fetch.php

Description : Delete a contact from the current session user's contact list.

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
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://dev.mediafire.com/api/1.2/contact/delete.php?session_token=749e4610d9e719620a1e9347ca9aabe5f86ac58d67c8bdd85f0eb4e043624ac70ec1a3f88dd49bb8126ad4c38a7686665ec66d727207ac1a99e9dc6c5cdf0772da405c3464c2d2af&contact_id=605
                            
                        
Response
<response>
  <action>contact/delete</action>
  <result>Success</result>
  <current_api_version>1.2</current_api_version>
</response>
JSON Example
Request
http://dev.mediafire.com/api/contact/delete.php?contact_id=605&session_token=749e4610d9e719620a1e9347ca9aabe5f86ac58d67c8bdd85f0eb4e043624ac70ec1a3f88dd49bb8126ad4c38a7686665ec66d727207ac1a99e9dc6c5cdf0772da405c3464c2d2af&response_format=json
Response
{
  "response": {
    "action": "contact/delete",
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Fetch


GET http://www.mediafire.com/api/1.2/contact/fetch.php
POST http://www.mediafire.com/api/1.2/contact/fetch.php

Description : Returns the contact list (contactkey, display name, first name, last name, avatar, email, phone, means_of_contact, birthdate, location, gender, website, created date, & contact type), revision, and count of the current session user. If method = "autocomplete", the contact list is returned as a trie (radix tree) structure. It is faster to traverse the trie branches using contact names and emails to find contacts. The trie is saved can be returned "raw" or in a "succinct" format. The response will contain the trie (base-64 encoded), the directory (base-64 encoded), and the number of nodes.

Required Parameters:


Relative Parameters:

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

Optional Parameters:

  • method : The method of getting the contact list. "normal" or "autocomplete" (default "normal"). If this is passed, group_contacts, start, and limit are ignored. "autocomplete" will return a succinct trie by default.
  • contact_key : A single contact key or a comma-separated list. When the 'method' is 'normal', only data for these contacts will be returned.
  • group_contacts : Specifies whether to return contacts separated into their contact groups. 'yes' or 'no' (default = 'no').
  • start : The number of contacts to skip (default = 0).
  • limit : The maximum number of contacts to be returned (default = "all").
    • If limit = 0: or is not provided, it will return all contacts beyond start.
    • Otherwise, it will return at most the number of contacts specified.
  • raw : Specifies whether the trie data should be returned in its original (non-succinct) form. 'yes' or 'no' (default = 'no').
  • response_format : 'xml' or 'json' (default 'xml')


Response Properties

Name Description Type
contact_groups [DEPRECATED] list
contacts A list containing information for each contact list of objects
count The amount of contacts in the user's account integer
revision The revision number of the device integer
epoch [DEPRECATED] integer
result Indicates if the API call was successful: 'Success' or 'Error' string
current_api_version The latest stable API version number string

Specific Responses About a Contact
Name Description Type
contact_key The contact key string
display_name The contact's display name string
first_name The contact's first name string
last_name The contact's last name string
avatar The URL location of the avatar string
email The contact's email address string
phone The contact's phone number string
source_uid The contact's email address string
birthdate The contact's birthdate string datestamp
location The contact's location string
gender The contact's gender string
website The contact's website string
options A bitmask indicating contact options. Currently unused. bitmask
created The date and time the contact was created string timestamp
contact_type The contact type ("mediafire", "facebook", "gmail", "twitter"...) string

Error Codes

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


Examples:

Example 1 (contact details with XML):
Request
http://www.mediafire.com/api/contact/fetch.php?session_token=749e4610d9e719620a1e9347ca9aabe5f86ac58d67c8bdd85f0eb4e043624ac70ec1a3f88dd49bb8126ad4c38a7686665ec66d727207ac1a99e9dc6c5cdf0772da405c3464c2d2af

                        
Response
<response>
  <action>contact/fetch</action>
  <contact_groups/>
  <contacts>
    <contact>
      <contact_key>0qpf4p2</contact_key>
      <display_name>Joe LeMay</display_name>
      <first_name>Joe</first_name>
      <last_name>LeMay</last_name>
      <avatar>
        http://www16.mediafire.com/convkey/f90b/b3imbhdzs3a24uo1g.jpg
      </avatar>
      <email/>
      <phone/>
      <source_uid>100004086472349</source_uid>
      <birthdate>0000-00-00</birthdate>
      <location/>
      <gender>male</gender>
      <website/>
      <options>0</options>
      <created>2014-06-30 10:59:29</created>
      <contact_type>facebook</contact_type>
    </contact>
    <contact>
      <contact_key>2cb9u7c</contact_key>
      <display_name>Vina Tivar Jones</display_name>
      <first_name>Vina</first_name>
      <last_name>Jones</last_name>
      <avatar>
        https://www.mediafire.com/images/icons/myfiles/default.png
      </avatar>
      <email/>
      <phone/>
      <source_uid>1634733246</source_uid>
      <birthdate>0000-00-00</birthdate>
      <location/>
      <gender>female</gender>
      <website/>
      <options>0</options>
      <created>2014-06-30 10:59:29</created>
      <contact_type>facebook</contact_type>
    </contact>
    <contact>
      <contact_key>895s49j</contact_key>
      <display_name>Jonesy</display_name>
      <first_name>Cliff</first_name>
      <last_name>Jones</last_name>
      <avatar>
        http://www16.mediafire.com/convkey/f303/k68bmskgc98subj1g.jpg
      </avatar>
      <email>cliffjones@example.com</email>
      <phone/>
      <source_uid>cj@gmail.com</source_uid>
      <birthdate>1982-11-20</birthdate>
      <location/>
      <gender>none</gender>
      <website>http://vokation.com</website>
      <options>0</options>
      <created>2014-06-17 13:03:33</created>
      <contact_type>mediafire</contact_type>
    </contact>
  </contacts>
  <count>3</count>
  <revision>1</revision>
  <epoch>1415635754</epoch>
  <result>Success</result>
  <current_api_version>1.2</current_api_version>
</response>
                        

Example 2 (contact details with JSON):
Request
http://www.mediafire.com/api/contact/fetch.php?session_token=749e4610d9e719620a1e9347ca9aabe5f86ac58d67c8bdd85f0eb4e043624ac70ec1a3f88dd49bb8126ad4c38a7686665ec66d727207ac1a99e9dc6c5cdf0772da405c3464c2d2af&response_format=json



                        
Response
{
  "response": {
    "action": "contact/fetch",
    "contact_groups": [],
    "contacts": [
      {
        "contact_key": "0qpf4p2",
        "display_name": "Joe LeMay",
        "first_name": "Joe",
        "last_name": "LeMay",
        "avatar": "http://www16.mediafire.com/convkey/f90b/b3imbhdzs3a24uo1g.jpg",
        "email": "",
        "phone": "",
        "source_uid": "100004086472349",
        "birthdate": "0000-00-00",
        "location": "",
        "gender": "male",
        "website": "",
        "options": "0",
        "created": "2014-06-30 10:59:29",
        "contact_type": "facebook"
      },
      {
        "contact_key": "2cb9u7c",
        "display_name": "Vina Tivar Jones",
        "first_name": "Vina",
        "last_name": "Jones",
        "avatar": "https://www.mediafire.com/images/icons/myfiles/default.png",
        "email": "",
        "phone": "",
        "source_uid": "1634733246",
        "birthdate": "0000-00-00",
        "location": "",
        "gender": "female",
        "website": "",
        "options": "0",
        "created": "2014-06-30 10:59:29",
        "contact_type": "facebook"
      },
      {
        "contact_key": "895s49j",
        "display_name": "Jonesy",
        "first_name": "Cliff",
        "last_name": "Jones",
        "avatar": "http://www16.mediafire.com/convkey/f303/k68bmskgc98subj1g.jpg",
        "email": "cliffjones@example.com",
        "phone": "",
        "source_uid": "cj@gmail.com",
        "birthdate": "1982-11-20",
        "location": "",
        "gender": "none",
        "website": "http://vokation.com",
        "options": "0",
        "created": "2014-06-17 13:03:33",
        "contact_type": "mediafire"
      }
    ],
    "count": "3",
    "revision": "1",
    "epoch": "1415635754",
    "result": "Success",
    "current_api_version": "1.2"
  }
}
}

Example 3 (succinct auto-complete trie with XML):

Request
http://www.mediafire.com/api/1.2/contact/fetch.php?session_token=0a7ae1b77061da54796078b3906b7a7bab9747dc6e7848876674eca0055821c85196e164f1fa1d17cfcf9b2dea8268b42b920b3b7948f4de4cbab9c716bcb827267e3f3a6341dc60&method=autocomplete
                        
Response
<response>
  <action>contact/fetch</action>
  <node_count>32</node_count>
  <directory>IGpzb21oaW50QHNobW1laS50Y2hvQG1nbWFpbC5jb20=</directory>
<data>Sm9obiBTbWl0aC8xODQvSm9obi9odHRwOiUyRiUyRmkuaW1ndXIuY29tJTJGNFdHMG9ldi5qcGcvMSM3LDExfEpvaG4gU21pdGgvMTg0L2pvaG5AZXhhbXBsZS5jb20vaHR0cHM6JTJGJTJGZGV2Lm1lZGlhZmlyZS5jb20lMkZpbWFnZXMlMkZpY29ucyUyRm15ZmlsZXMlMkZkZWZhdWx0LnBuZy8yIzcsMTF8am9obkBtZS5jb20vMTg0L0pvaG4vaHR0cDolMkYlMkZpLmltZ3VyLmNvbSUyRjRXRzBvZXYuanBnLzEjMjJ8am9obnNtaXRoQGdtYWlsLmNvbS8xODQvSm9obi9odHRwOiUyRiUyRmkuaW1ndXIuY29tJTJGNFdHMG9ldi5qcGcvMiMzMQ==</data>
  <trie>tVVqlVVUqqo</trie>
  <revision>2</revision>
  <epoch>1394063410</epoch>
  <result>Success</result>
  <current_api_version>1.2</current_api_version>
</response>

Example 4 (succinct auto-complete tree with JSON):

Request
http://www.mediafire.com/api/1.2/contact/fetch.php?session_token=0a7ae1b77061da54796078b3906b7a7bab9747dc6e7848876674eca0055821c85196e164f1fa1d17cfcf9b2dea8268b42b920b3b7948f4de4cbab9c716bcb827267e3f3a6341dc60&method=autocomplete
                        
Response
{
  "response": {
    "action": "contact/fetch",
    "node_count": "32",
    "directory": "IGpzb21oaW50QHNobW1laS50Y2hvQG1nbWFpbC5jb20=",
    "data": "Sm9obiBTbWl0aC8xODQvSm9obi9odHRwOiUyRiUyRmkuaW1ndXIuY29tJTJGNFdHMG9ldi5qcGcvMSM3LDExfEpvaG4gU21pdGgvMTg0L2pvaG5AZXhhbXBsZS5jb20vaHR0cHM6JTJGJTJGZGV2Lm1lZGlhZmlyZS5jb20lMkZpbWFnZXMlMkZpY29ucyUyRm15ZmlsZXMlMkZkZWZhdWx0LnBuZy8yIzcsMTF8am9obkBtZS5jb20vMTg0L0pvaG4vaHR0cDolMkYlMkZpLmltZ3VyLmNvbSUyRjRXRzBvZXYuanBnLzEjMjJ8am9obnNtaXRoQGdtYWlsLmNvbS8xODQvSm9obi9odHRwOiUyRiUyRmkuaW1ndXIuY29tJTJGNFdHMG9ldi5qcGcvMiMzMQ==",
    "trie": "tVVqlVVUqqo",
    "revision": "2",
    "epoch": "1394063410",
    "result": "Success",
    "current_api_version": "1.2"
  }
}
Contact_Trie

To decode and use the above trie, follow these steps:

  • Convert the trie into a binary string. The above Trie "tVVqlVVUqqo" would be converted to "101101010101010101101010100101010101010101010100101010101010101000". The string should always have as many 1s as the number of nodes and as many 0s as the number of nodes + 1.
  • Based on the binary string, we build the tree from top to bottom and from left to right and we number the nodes starting from 0 to 31. Those numbers would be the indexes. Each bit value of 1 indicates that there is a child, and the bit value of 0 indicates the end of the children list for the node. See the graph below.
  • Decode the directory string to get the list of characters corresponding to the nodes. The above string "IGpzb21oaW50QHNobW1laS50Y2hvQG1nbWFpbC5jb20=" decodes to "jsomhint@shmmei.tcho@mgmail.com". That means node 0 has no letter, node 1 has the letter "j", node 2 has the letter "s", and so no. See the graph below.
  • Next, decode the data. Contacts are separated by a pipe ("|"), and each contact is composed of two strings separated by a hash ("#"). The first string is itself a list of details separated by slashes ("/"): the contact name/email, the contact ID, a handle to display, the URL of an avatar, and the contact type. The second string is a comma-separated list of node indexes for that contact. The above directory value "Sm9obiBTbWl0aC8xODQvSm9obi9odHRwOiUyRiUyRmkuaW1ndXIuY29tJTJGNFdHMG9ldi5qcGcvMSM3...YWlsLmNvbS8xODQvSm9obi9odHRwOiUyRiUyRmkuaW1ndXIuY29tJTJGNFdHMG9ldi5qcGcvMiMzMQ==" becomes: "John Smith/184/John/http:%2F%2Fi.imgur.com%2F4WG0oev.jpg/1#7,11|John Smith/184/john@example.com/https:%2F%2Fdev.mediafire.com%2Fimages%2Ficons%2Fmyfiles%2Fdefault.png/2#7,11|john@me.com/184/John/http:%2F%2Fi.imgur.com%2F4WG0oev.jpg/1#22|johnsmith@gmail.com/184/John/http:%2F%2Fi.imgur.com%2F4WG0oev.jpg/2#31". The first contact "John Smith" has an ID of "184", "John" as a handle, an avatar URL of "http://i.imgur.com/4WG0oev.jpg" (with slashes restored), and a contact type of 1, which indicates a MediaFire contact. This contact is under the leaf nodes with indexes 7 and 11.

Example 5 (another succinct auto-complete trie with XML):

Request
http://www.mediafire.com/api/contact/fetch.php?method=autocomplete&session_token=784766852fb31fee085ea78471ab5ffa6722d0d84090791db8092e7eec9634991de19a0b4fc2809dbc0f1c1653c1b520189a5a08e0cd508306e6e098809c70d055aea374b496906b

                        
Response
<response>
  <action>contact/fetch</action>
  <node_count>33</node_count>
  <directory>IG1zb3RtZUB2ZWV4QGFlbXhwYWxtZXAubGNlby5tY29t</directory>
<data>bW9tQGV4YW1wbGUuY29tL2h6emwxaXEvbW9tQGV4YW1wbGUuY29tL2h0dHBzOiUyRiUyRmRldi5tZWRpYWZpcmUuY29tJTJGaW1hZ2VzJTJGaWNvbnMlMkZteWZpbGVzJTJGZGVmYXVsdC5wbmcvMCMyOXxzdGV2ZUBleGFtcGxlLmNvbS9mODczZzV6L3N0ZXZlQGV4YW1wbGUuY29tL2h0dHBzOiUyRiUyRmRldi5tZWRpYWZpcmUuY29tJTJGaW1hZ2VzJTJGaWNvbnMlMkZteWZpbGVzJTJGZGVmYXVsdC5wbmcvMCMzMg==</data>
  <trie>tVVVVVVVVVK</trie>
  <revision>3</revision>
  <epoch>1394066927</epoch>
  <result>Success</result>
  <current_api_version>1.2</current_api_version>
</response>
                        

Example 6 (another succinct auto-complete trie with JSON):

Request
http://www.mediafire.com/api/contact/fetch.php?method=autocomplete&session_token=784766852fb31fee085ea78471ab5ffa6722d0d84090791db8092e7eec9634991de19a0b4fc2809dbc0f1c1653c1b520189a5a08e0cd508306e6e098809c70d055aea374b496906b&response_format=json

                        
Response
{
  "response": {
    "action": "contact/fetch",
    "node_count": "33",
    "directory": "IG1zb3RtZUB2ZWV4QGFlbXhwYWxtZXAubGNlby5tY29t",
    "data": "bW9tQGV4YW1wbGUuY29tL2h6emwxaXEvbW9tQGV4YW1wbGUuY29tL2h0dHBzOiUyRiUyRmRldi5tZWRpYWZpcmUuY29tJTJGaW1hZ2VzJTJGaWNvbnMlMkZteWZpbGVzJTJGZGVmYXVsdC5wbmcvMCMyOXxzdGV2ZUBleGFtcGxlLmNvbS9mODczZzV6L3N0ZXZlQGV4YW1wbGUuY29tL2h0dHBzOiUyRiUyRmRldi5tZWRpYWZpcmUuY29tJTJGaW1hZ2VzJTJGaWNvbnMlMkZteWZpbGVzJTJGZGVmYXVsdC5wbmcvMCMzMg==",
    "trie": "tVVVVVVVVVK",
    "revision": "3",
    "epoch": "1394066927",
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Example 7 (the same trie in raw form in XML):

Request
http://www.mediafire.com/api/1.2/contact/fetch.php?session_token=0a7ae1b77061da54796078b3906b7a7bab9747dc6e7848876674eca0055821c85196e164f1fa1d17cfcf9b2dea8268b42b920b3b7948f4de4cbab9c716bcb827267e3f3a6341dc60&method=autocomplete&raw=yes
                        
Response
<response>
   <action>contact/fetch</action>
   <node_count>33</node_count>
   <directory>IG1zb3RtZUB2ZWV4QGFlbXhwYWxtZXAubGNlby5tY29t</directory>
   <data>bW9tQGV4YW1wbGUuY29tL2h6emwxaXEvbW9tQGV4YW1wbGUuY29tL2h0dHBzOiUyRiUyRmRldi5tZWRpYWZpcmUuY29tJTJGaW1hZ2VzJTJGaWNvbnMlMkZteWZpbGVzJTJGZGVmYXVsdC5wbmcvMCMyOXxzdGV2ZUBleGFtcGxlLmNvbS9mODczZzV6L3N0ZXZlQGV4YW1wbGUuY29tL2h0dHBzOiUyRiUyRmRldi5tZWRpYWZpcmUuY29tJTJGaW1hZ2VzJTJGaWNvbnMlMkZteWZpbGVzJTJGZGVmYXVsdC5wbmcvMCMzMg==</data>
   <revision>3</revision>
   <epoch>1394066927</epoch>
   <result>Success</result>
   <current_api_version>#API_VERSION</current_api_version>
</response>
                        
Example 8 (succinct auto-complete trie with XML):
Request
http://www.mediafire.com/api/contact/fetch.php?method=autocomplete&raw=yes&session_token=784766852fb31fee085ea78471ab5ffa6722d0d84090791db8092e7eec9634991de19a0b4fc2809dbc0f1c1653c1b520189a5a08e0cd508306e6e098809c70d055aea374b496906b&response_format=json
     
Response
{
  "response": {
    "action": "contact/fetch",
    "node_count": "33",
    "directory": "eyJyb290Ijp7Im0iOnsibyI6eyJtIjp7IkAiOnsiZSI6eyJ4Ijp7ImEiOnsibSI6eyJwIjp7ImwiOnsiZSI6eyIuIjp7ImMiOnsibyI6eyJtIjp7ImVuZCI6WzBdfX19fX19fX19fX19fX19LCJzIjp7InQiOnsiZSI6eyJ2Ijp7ImUiOnsiQCI6eyJlIjp7IngiOnsiYSI6eyJtIjp7InAiOnsibCI6eyJlIjp7Ii4iOnsiYyI6eyJvIjp7Im0iOnsiZW5kIjpbMV19fX19fX19fX19fX19fX19fX19",
    "data": "bW9tQGV4YW1wbGUuY29tL2h6emwxaXEvbW9tQGV4YW1wbGUuY29tL2h0dHBzOiUyRiUyRmRldi5tZWRpYWZpcmUuY29tJTJGaW1hZ2VzJTJGaWNvbnMlMkZteWZpbGVzJTJGZGVmYXVsdC5wbmcvMHxzdGV2ZUBleGFtcGxlLmNvbS9mODczZzV6L3N0ZXZlQGV4YW1wbGUuY29tL2h0dHBzOiUyRiUyRmRldi5tZWRpYWZpcmUuY29tJTJGaW1hZ2VzJTJGaWNvbnMlMkZteWZpbGVzJTJGZGVmYXVsdC5wbmcvMA==",
    "revision": "3",
    "epoch": "1394066927",
    "result": "Success",
    "current_api_version": "1.2"
  }
}

The above base-64 strings decode as follows:

  • directory: {"root":{"m":{"o":{"m":{"@":{"e":{"x":{"a":{"m":{"p":{"l":{"e":{".":{"c":{"o":{"m":{"end":[0]}}}}}}}}}}}}}}},"s":{"t":{"e":{"v":{"e":{"@":{"e":{"x":{"a":{"m":{"p":{"l":{"e":{".":{"c":{"o":{"m":{"end":[1]}}}}}}}}}}}}}}}}}}}
  • data: mom@example.com/hzzl1iq/mom@example.com/https:%2F%2Fdev.mediafire.com%2Fimages%2Ficons%2Fmyfiles%2Fdefault.png/0|steve@example.com/f873g5z/steve@example.com/https:%2F%2Fdev.mediafire.com%2Fimages%2Ficons%2Fmyfiles%2Fdefault.png/0

In this format, directory can be processed as JSON data, yielding the trie structure without a need for the binary trie string. Each end node contains a list of index values corresponding to elements of data (beginning with 0).


Get Avatar


GET http://www.mediafire.com/api/1.2/contact/get_avatar.php
POST http://www.mediafire.com/api/1.2/contact/get_avatar.php

Description: Returns the URL of a given contact's avatar image.

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
avatar Indicates the URL of the avatar 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/contact/get_avatar.php?contact_key=h3qxc97&session_token=e6829fe5892012154097c19ed0635741a6269cbe5dec2a5ae600b2d70e64b45afd03e00cd15ca0d8d17c2348933894db1ef00dda21bd098d6ba1f51f5e82f7a1a28b454f1bd399ae
                
Response
<response>
  <action>contact/get_avatar</action>
  <avatar>
        http://www.mediafire.com/convkey/f8a8/0qhafc7qbmlw4dy0g.jpg
  </avatar>
  <result>Success</result>
  <current_api_version>1.2</current_api_version>
</response>                    
Example 2 (JSON):
Request
http://www.mediafire.com/api/contact/get_avatar.php?contact_key=h3qxc97&session_token=e6829fe5892012154097c19ed0635741a6269cbe5dec2a5ae600b2d70e64b45afd03e00cd15ca0d8d17c2348933894db1ef00dda21bd098d6ba1f51f5e82f7a1a28b454f1bd399ae&response_format=json
                
Response
"response": {
    "action": "contact/get_avatar",
    "avatar": "
    http://devpreview.mediafire.com/convkey/f8a8/0qhafc7qbmlw4dy0g.jpg
  ",
    "result": "Success",
    "current_api_version": "1.2"
  }
}

Set Avatar


GET http://www.mediafire.com/api/1.2/contact/set_avatar.php
POST http://www.mediafire.com/api/1.2/contact/set_avatar.php

Description: Save a copy of a given contact's remote avatar image for use in the operating user's list.

Required Parameters:

  • session_token : A type 1 or type 2 session token. (Type 2 will require a call signature).
  • contact_key : The unique key of the contact whose avatar is to be returned.
  • url : The URL where this image file is located.

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
upload_key The uploadkey of the avatar 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/contact/set_avatar.php?contact_key=h3qxc97&url=https://si0.twimg.com/profile_images/103344356/JG-0511e2.jpg&session_token=e6829fe5892012154097c19ed0635741a6269cbe5dec2a5ae600b2d70e64b45afd03e00cd15ca0d8d17c2348933894db1ef00dda21bd098d6ba1f51f5e82f7a1a28b454f1bd399ae
                        
Response
<response>
  <action>contact/set_avatar</action>
  <upload_key>kt2qzd93wq</upload_key>
  <result>Success</result>
  <current_api_version>1.2</current_api_version>
</response>                        

Example 2 (API Call Failure - Bad URL):

Request
http://www.mediafire.com/api/1.2/contact/set_avatar.php?contact_key=h3qxc97&url=badurl&session_token=e6829fe5892012154097c19ed0635741a6269cbe5dec2a5ae600b2d70e64b45afd03e00cd15ca0d8d17c2348933894db1ef00dda21bd098d6ba1f51f5e82f7a1a28b454f1bd399ae
                        
Response
<response>
    <action>contact/set_avatar</action>
    <message>Required parameters for this request are missing</message>
    <error>128</error>
    <result>Error</result>
    <current_api_version>1.2</current_api_version>
  </response>
Example 3 (success with JSON):
Request
http://www.mediafire.com/api/contact/set_avatar.php?contact_key=h3qxc97&url=https://si0.twimg.com/profile_images/103344356/JG-0511e2.jpg&session_token=e6829fe5892012154097c19ed0635741a6269cbe5dec2a5ae600b2d70e64b45afd03e00cd15ca0d8d17c2348933894db1ef00dda21bd098d6ba1f51f5e82f7a1a28b454f1bd399ae&response_format=json
Response
{
  "response": {
    "action": "contact/set_avatar",
    "upload_key": "kt2qzd93wq",
    "result": "Success",
    "current_api_version": "1.2"
  }
}