ApiFunction_create_folder

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

create_folder

 



Description

 

This method creates a new folder in a user's account.

 

Input parameters:

 

Name Type Description
api_key string The API key obtained when registering a project with OpenBox.
auth_token string The authentication token for your service to connect to a user's Box account - obtained through the get_auth_token method.
parent_id long The folder_id in which the new folder will be created.
name string The name of the folder when it will be created.
share long A binary parameter which can be set to 1 in order to allow the folder to be shared.

 

Output parameters:

 

Name Type Description
status string

On a successful result, the status parameter will be 'create_ok'.

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

  • 'no_parent' - The folder_id provided is not a valid folder_id for the user's account.
  • 's_folder_exists' - A folder withthe same name already exists in that location.
  • '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.
folder SOAPFolder, base64Binary XML representing basic information about the folder that was created.

 

 

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

 

 

Property Type Description
folder_id long Unique identifier for the folder.
folder_name string The name of the folder.
user_id long The id of the user who owns the folder.
path string Represents the path from the root directory to this folder.
shared long (boolean) Whether this folder is being shared with others to view.  "0" means the folder is private, "1" means the folder is shared and has an enabled shared_link.
public_name string A unique identifier used to generate shared pages and widgets.
show_comments deprecated You can ignore this.
parent_folder_id long

The folder_id of the folder's parent.  If this folder lies at the root, the value will be "0".

password string If this is a shared folder with password protection, the password can be obtained here.

 

 

REST

 

Request

 

https://www.box.net/api/1.0/rest?action=create_folder&api_key=rrc1d3ntb53tt6b2vhail6rdtrsxov3v&auth_token=5oahsklt4x0emkj1rdzm3nug1aq81t9k&parent_id=0&name=New%20Folder&share=1

  

Response

 

<?xml version='1.0' encoding='UTF-8'?>
<response>
<status>create_ok</status>
<folder>
<folder_id>738</folder_id>
<folder_name>New Folder</folder_name>
<folder_type_id>0</folder_type_id>
<user_id>453</user_id>
<path></path>
<shared>1</shared>
<public_name>gh23ghjj</public_name>
<show_comments></show_comments>
<parent_folder_id>0</parent_folder_id>
<password></password>
</folder>
</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:create_folder>
<api_key xsi:type="xsd:string">rrc1d3ntb53tt6b2vhail6rdtrsxov3v</api_key>
<sid xsi:type="xsd:string">baa8b089c5a635adc0baa68aa1c61bbe</sid>
<parent_id xsi:type="xsd:long">428</parent_id>
<name xsi:type="xsd:string">New Folder</name>
<share xsi:type="xsd:long">1</share>
</tns:create_folder>
</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:create_folderResponse>
<status xsi:type="xsd:string">create_ok</status>
<folder xsi:type="ns4:SOAPFolder">
<folder_id xsi:type="xsd:long">541</folder_id>
<folder_name xsi:type="xsd:string">New Folder</folder_name>
<folder_type_id xsi:type="xsd:long">0</folder_type_id>
<user_id xsi:type="xsd:int">453</user_id>
<path xsi:type="xsd:string">/12345wwv</path>
<shared xsi:type="xsd:int">0</shared>
<public_name xsi:type="xsd:string">gh23ghjj</public_name>
<password xsi:type="xsd:string"></password>
<parent_folder_id xsi:type="xsd:long">428</parent_folder_id>
</folder>
</ns4:create_folderResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

XML

 

Request

 

<?xml version='1.0' encoding='UTF-8' ?>
<request>
<action>create_folder</action>
<api_key>rrc1d3ntb53tt6b2vhail6rdtrsxov3v</api_key>
<auth_token>5oahsklt4x0emkj1rdzm3nug1aq81t9k</auth_token>
<parent_id>0</parent_id>
<name>New Folder</name>
<share>1</share>
</request>

 

Response

 

<?xml version='1.0' encoding='UTF-8'?>
<response>
<status>create_ok</status>
<folder>
<folder_id>738</folder_id>
<folder_name>New Folder</folder_name>
<folder_type_id>0</folder_type_id>
<user_id>453</user_id>
<path></path>
<shared>1</shared>
<public_name>gh23ghjj</public_name>
<show_comments></show_comments>
<parent_folder_id>0</parent_folder_id>
<password></password>
</folder>
</response>

 


 

Need additional assistance? Please feel free to Contact us