Returns all of the folder's collaborations. This API does not support paging -- it always returns all of the collaborations. Each collaboration object has details on which user or group has access to the file and with what role.
curl https://api.box.com/2.0/folders/FOLDER_ID/collaborations \
-H "Authorization: Bearer BOX_ACCESS_TOKEN"
#import <CkoRest.h>
#import <CkoStringBuilder.h>
#import <CkoJsonObject.h>
#import <NSString.h>
CkoRest *rest = [[CkoRest alloc] init];
BOOL success;
// URL: https://api.box.com/2.0/folders/FOLDER_ID/collaborations
BOOL bTls = YES;
int port = 443;
BOOL bAutoReconnect = YES;
success = [rest Connect: @"api.box.com" port: [NSNumber numberWithInt: port] tls: bTls autoReconnect: bAutoReconnect];
if (success != YES) {
NSLog(@"%@%d",@"ConnectFailReason: ",[rest.ConnectFailReason intValue]);
NSLog(@"%@",rest.LastErrorText);
return;
}
[rest AddHeader: @"Authorization" value: @"Bearer BOX_ACCESS_TOKEN"];
CkoStringBuilder *sbResponseBody = [[CkoStringBuilder alloc] init];
success = [rest FullRequestNoBodySb: @"GET" uriPath: @"/2.0/folders/FOLDER_ID/collaborations" sb: sbResponseBody];
if (success != YES) {
NSLog(@"%@",rest.LastErrorText);
return;
}
CkoJsonObject *jsonResponse = [[CkoJsonObject alloc] init];
[jsonResponse LoadSb: sbResponseBody];
int total_count;
int i;
int count_i;
NSString *type = 0;
NSString *id = 0;
NSString *created_byType = 0;
NSString *created_byId = 0;
NSString *created_byName = 0;
NSString *created_byLogin = 0;
NSString *created_at = 0;
NSString *modified_at = 0;
BOOL expires_at;
NSString *status = 0;
NSString *accessible_byType = 0;
NSString *accessible_byId = 0;
NSString *accessible_byName = 0;
NSString *accessible_byLogin = 0;
NSString *role = 0;
NSString *acknowledged_at = 0;
BOOL item;
total_count = [[jsonResponse IntOf: @"total_count"] intValue];
i = 0;
count_i = [[jsonResponse SizeOfArray: @"entries"] intValue];
while (i < count_i) {
jsonResponse.I = [NSNumber numberWithInt: i];
type = [jsonResponse StringOf: @"entries[i].type"];
id = [jsonResponse StringOf: @"entries[i].id"];
created_byType = [jsonResponse StringOf: @"entries[i].created_by.type"];
created_byId = [jsonResponse StringOf: @"entries[i].created_by.id"];
created_byName = [jsonResponse StringOf: @"entries[i].created_by.name"];
created_byLogin = [jsonResponse StringOf: @"entries[i].created_by.login"];
created_at = [jsonResponse StringOf: @"entries[i].created_at"];
modified_at = [jsonResponse StringOf: @"entries[i].modified_at"];
expires_at = [jsonResponse IsNullOf: @"entries[i].expires_at"];
status = [jsonResponse StringOf: @"entries[i].status"];
accessible_byType = [jsonResponse StringOf: @"entries[i].accessible_by.type"];
accessible_byId = [jsonResponse StringOf: @"entries[i].accessible_by.id"];
accessible_byName = [jsonResponse StringOf: @"entries[i].accessible_by.name"];
accessible_byLogin = [jsonResponse StringOf: @"entries[i].accessible_by.login"];
role = [jsonResponse StringOf: @"entries[i].role"];
acknowledged_at = [jsonResponse StringOf: @"entries[i].acknowledged_at"];
item = [jsonResponse IsNullOf: @"entries[i].item"];
i = i + 1;
}
{
"total_count": 1,
"entries": [
{
"type": "collaboration",
"id": "14176246",
"created_by": {
"type": "user",
"id": "4276790",
"name": "David Lee",
"login": "david@box.com"
},
"created_at": "2011-11-29T12:56:35-08:00",
"modified_at": "2012-09-11T15:12:32-07:00",
"expires_at": null,
"status": "accepted",
"accessible_by": {
"type": "user",
"id": "755492",
"name": "Simon Tan",
"login": "simon@box.net"
},
"role": "editor",
"acknowledged_at": "2011-11-29T12:59:40-08:00",
"item": null
}
]
}