Login   Register  
PHP Classes
elePHPant
Icontem

box.com copy folder

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      PHP OAuth API  >  All threads  >  box.com copy folder  >  (Un) Subscribe thread alerts  
Subject:box.com copy folder
Summary:Looking for example of the box.com copy folder
Messages:2
Author:George Lerma
Date:2013-11-21 23:47:35
Update:2013-11-27 06:02:09
 

  1. box.com copy folder   Reply   Report abuse  
Picture of George Lerma
George Lerma
2013-11-21 23:47:35
Hi,

Thank you for creating this great class. I am trying to understand how the format of the associative array would be when performing a POST on a copy of folder action on the box.com V2 API. I am having trouble getting it to be in the correct format.

Here is the API action reference: http://developers.box.com/docs/#folders-copy-a-folder.

The box API document specifies up to three attributes for the call:
1. parent - Object representing the new location of the folder.
2. id - The ID of the destination folder.
3. name - An optional new name for the folder.

Here is a curl example:
curl https://api.box.com/2.0/folders/FOLDER_ID/copy \
-H "Authorization: Bearer ACCESS_TOKEN" \
-d '{"parent": {"id" : DESTINATION_FOLDER_ID}}' \
-X POST


How would i do this using your class?

Thanks,
George lerma

  2. Re: box.com copy folder   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2013-11-27 06:02:09 - In reply to message 1 from George Lerma
I have not tried it yet but you may want to try this:

$parent = new stdClass;
$parent->id = 'DESTINATION_FOLDER_ID';
$values = new stdClass;
$values->parent = $parent;
$success = $client->CallAPI(
'https://api.box.com/2.0/folders/FOLDER_ID/copy',
'POST', $values, array('FailOnAccessError'=>true), $result);