Reputation: 4121
I am trying to add a group as a collaborator of a folder using the BOX.net api but i can't.
I am not having any issues to add users, but i couldn't add groups.
I am doing it as they say to do it: {id: "GROUP_ID"} but i am getting a "NOT FOUND" error.
I checked the group and folder id and they are both correct.
Did anyone face this issue before? Is there somebody who can help me with this? I would really appreciate it.
Thanks in advance,
Regards,
Marcelo
Upvotes: 0
Views: 479
Reputation: 407
Here's a small example of adding a group as collaborator (PHP). This is done via the V2 API, in case you're using the V1 api (saw you mentioned box.net's api, which is the V1 api).
function addGroupColaborator($folderId, $groupId, $accessType, $accessToken){
$options = array(
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_VERBOSE => true,
CURLOPT_HEADER => false,
CURLINFO_HEADER_OUT => false,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => false
);
$url = 'https://api.box.com/2.0/collaborations?notify=false';
$options[CURLOPT_HTTPHEADER] = array ("Authorization: Bearer ".$accessToken);
$postf = array(
"item" => array(
"id" => $folderId,
"type" => "folder"
),
"accessible_by" => array(
"id" => $groupId,
"type" => 'group'
),
"role" => $accessType
);
$options[CURLOPT_POST] = true;
$options[CURLOPT_POSTFIELDS] = json_encode($postf);
$ch = curl_init($url);
curl_setopt_array($ch, $options);
$result = curl_exec($ch);
curl_close($ch);
return json_decode($result, true);
}
Upvotes: 0
Reputation: 2599
You have to be a group administrator on the Box Enterprise in order to manage groups. You may need to ask your Box admin to add you as a co-admin, and give you the "manage groups" permission.
Upvotes: 1
Reputation: 241
Make sure you pass in "type":"group" in the accessible_by field in addition to "id":"GROUP_ID".
This should be documented soon.
Upvotes: 0