ApiFunction_public_share

Page history last edited by jeremy@... 4 mos ago

public_share

 



Description

 

 

This method makes a file or folder shareable, and may initiate sharing through Box.net email notifications.

 

 

Input parameters:

 

Name Type Description
api_key string The API key obtained when registering a project with OpenBox.
auth_token string The authentication token obtained when a user authenticates your application with Box.
target string The type of item to be shared.  This can be set as 'file' or 'folder'.
target_id long The id of the item you wish to share.  If the target is a folder, this will be the folder_id.  If the target is a file, this will be the file_id.
password string The password to protect the folder or file.
message string An message to be included in a notification email.
emails ArrayOfString An array of emails for which to notify users about the newly shared file or folder.

 

Output parameters:

 

Name Type Description
status string

If the operation was successful, the status parameter will be 'share_ok'.

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

  • 'not_logged_in' - The user is not logged into your application.  Your authentication_token is not valid.
  • 'application_restricted'- You provided an invalid api_key, or the api_key is restricted from calling this function.
  • 'wrong_node' - The item_id may be invalid.  Verify that the item_id is a valid id for an item in the user's account.
  • 'share_error' - For all other errors.  Verify that your target is 'file' or 'folder', and that the new name contains valid characters.
public_name string A unique  identifyer ofthe publicly shared file. This can be used to generate shared page Urls.

 

 

REST

 

Request

 

https://www.box.net/api/1.0/rest?action=public_share&api_key=rrc1d3ntb53tt6b2vhail6rdtrsxov3v&auth_token=rpuis3lincpbyz60gyym8s3xhnc6gbcl&target=folder&target_id=709&password=&message=hey&emails[]=email@example.com&emails[]=email2@example.com

 

 

 

Response

 

<?xml version='1.0' encoding='UTF-8'?>
<response>
<status>share_ok</status>
<public_name>ojf3i2n100</public_name>
</response>

SOAP

 

Request

 

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:boxnet" xmlns:types="urn:boxnet/encodedTypes"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>
<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<tns:public_share>
<api_key xsi:type="xsd:string">rrc1d3ntb53tt6b2vhail6rdtrsxov3v</api_key>
<sid xsi:type="xsd:string">baa8b089c5a635adc0baa68aa1c61bbe</sid>
<target xsi:type="xsd:string">file</target>
<target_id xsi:type="xsd:long">3778</target_id>
<password xsi:type="xsd:string">password</password>
<message xsi:type="xsd:string">hey</message>
<emails href="#id1" />
<soapenc:Array id="id1" soapenc:arrayType="xsd:string[2]">
<Item>notify1@email.com</Item>
<Item>notify2@email.com</Item>
</soapenc:Array>
</tns:public_share>

 

</soap:Body>
</soap: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:public_shareResponse>
<status xsi:type="xsd:string">share_ok</status>
<public_name xsi:type="xsd:string">a64ebam2dx</public_name>
</ns4:public_shareResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

XML

 

Request

 

<?xml version='1.0' encoding='UTF-8' ?>
<request>
<action>public_share</action>
<api_key>rrc1d3ntb53tt6b2vhail6rdtrsxov3v</api_key>
<auth_token>rpuis3lincpbyz60gyym8s3xhnc6gbcl</auth_token>
<target>folder</target>
<target_id>709</target_id>
<password></password>
<message>hey</message>
<emails>
<item>email@example.com</item>
<item>email2@example.com</item>
</emails>
</request>


 

Response

 

<?xml version='1.0' encoding='UTF-8'?>
<response>
<status>share_ok</status>
<public_name>ojf3i2n100</public_name>
</response>

 


 

Need additional assistance? Please feel free to Contact us