ApiFunction_get_friends

Page history last edited by jeremy@... 1 wk ago

get_friends

 



Description

 

This method is used to retrieve a list of the user's friends.

 

 

Input parameters:

 

Name Type Description
api_key string The API key obtained when registering a project with OpenBox.
auth_token string The ticket obtained from get_ticket, used to authenticate a user between Box and your application.
params ArrayOfString Allows you to set additional, optional parameters:
  • 'nozip' - do not zip the tree xml.

 

 

Output parameters:

 

Name Type Description
status string

If the operation was successful, the status will be 's_get_friends'.

If the result was not successful, the status field can be:

  • 'application_restricted' - You provided an invalid api_key, or the api_key is restricted from calling this function

  • 'not_logged_in' - The user did not successfully authenticate on the page provided in the authentication process.

  • 'e_get_friends' - Another error occured in your call.  You may want to verify that you are valid params[] input.

friends base64Binary An XML structure of the tree representing the folders and files from a user's particular folder (see sample structure below).

 

 

The returned 'friends' object in the output will contain the following properties:

 

 

Property Type Description
name string The Box.net username.  Upon registering this is the user's email address by default, but user's often change this in Settings.
email string The user's email address.
accepted long The number of folders on which this friend has accepted a collaboration invitation from the user.
avatar_url long A Url of the user's avatar (profile picture).
boxes base64binary

Contains the Urls for a user's public profile page  (this is an outdated feature feature).  boxes property contains:

  • id - the id of the public box
  • url- The URL of the public box
  • status - This tag will always be empty, so you can ignore it.

 

 

REST

 

Request

 

https://www.box.net/api/1.0/rest?action=get_friends&api_key=rrc1d3n4b53tt6b2vh1il6tdtrsxov3v&auth_token=ekp2t8vb8l1spb1mnonlqmgztkrq1rtl&params[]=nozip

 

 

Response

 

<?xml version='1.0' encoding='UTF-8' ?>
<response>
<status>s_get_friends</status>
<friends>
<friends>
<friend>
<name>email2@example.com</name>
<email>email2@example.com</email>
<accepted>1</accepted>
<avatar_url>http://box.net/index.php?rm=box_user_avatar&user_id=398396&width=40&height=40&type=large</avatar_url>
<boxes>
<box>
<id>15</id>
<url>http://box.net/p/email2</url>
<status/>
</box>
</boxes>
</friend>
</friends>
</friends>
</response>

 

SOAP

 

Request

 

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="urn:boxnet"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4:get_friends>
<api_key xsi:type="xsd:string">rrc1d3n4b53tt6b2vh1il6tdtrsxov3v</api_key>
<sid xsi:type="xsd:string">6tsncrgnlmbk06o8sfqnuydhqvm604rl</sid>
<params xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:string[1]" SOAP-ENC:offset="[0]">
<item xsi:type="xsd:string">nozip</item></params>
</ns4:get_friends>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

Response

 

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns4="urn:boxnet"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ns4:get_friendsResponse>
<status xsi:type="xsd:string">s_get_friends</status>
<friends xsi:type="xsd:base64Binary">

PGZyaWVuZHM+PGZyaWVuZD48bmFtZT5lbWFpbDJAZXhhbXBsZS5jb208L25hbWU+PGVtYWlsPmVt

YWlsMkBleGFtcGxlLmNvbTwvZW1haWw+PGFjY2VwdGVkPjE8L2FjY2VwdGVkPjxhdmF0YXJfdXJs

Pmh0dHA6Ly9ib3gubmV0L2luZGV4LnBocD9ybT1ib3hfdXNlcl9hdmF0YXImdXNlcl9pZD0zOTgz

OTYmd2lkdGg9NDAmaGVpZ2h0PTQwJnR5cGU9bGFyZ2U8L2F2YXRhcl91cmw+PGJveGVzPjxib3g+

PGlkPjE1PC9pZD48dXJsPmh0dHA6Ly9ib3gubmV0L3AvZW1haWwyPC91cmw+PHN0YXR1cy8+PC9i

b3g+PC9ib3hlcz48L2ZyaWVuZD48L2ZyaWVuZHM+PC9mcmllbmRzPg==

</ns4:get_friendsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

XML

 

Request

 

<?xml version='1.0' encoding='UTF-8' ?>
<request>
<action>get_friends</action>
<api_key>rrc1d3n4b53tt6b2vh1il6tdtrsxov3v</api_key>
<auth_token>79r205ihgupsbucfani0iu483oa1iupn</auth_token>
<params>
<item>nozip</item>
</params>
</request>

 

Response

 

<?xml version='1.0' encoding='UTF-8' ?>
<response>
<status>s_get_friends</status>
<friends>
<friends>
<friend>
<name>email2@example.com</name>
<email>email2@example.com</email>
<accepted>1</accepted>
<avatar_url>http://box.net/index.php?rm=box_user_avatar&user_id=398396&width=40&height=40&type=large</avatar_url>
<boxes>
<box>
<id>15</id>
<url>http://box.net/p/email2</url>
<status/>
</box>
</boxes>
</friend>
</friends>
</friends>
</response>

 


 

Need additional assistance? Please feel free to Contact us