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"
Use ChilkatAx-9.5.0-win32.pkg
Procedure Test
Handle hoRest
Boolean iSuccess
Boolean iBTls
Integer iPort
Boolean iBAutoReconnect
Variant vSbResponseBody
Handle hoSbResponseBody
Handle hoJsonResponse
Integer iTotal_count
Integer i
Integer iCount_i
String sType
String sId
String sCreated_byType
String sCreated_byId
String sCreated_byName
String sCreated_byLogin
String sCreated_at
String sModified_at
Boolean iExpires_at
String sStatus
String sAccessible_byType
String sAccessible_byId
String sAccessible_byName
String sAccessible_byLogin
String sRole
String sAcknowledged_at
Boolean iItem
String sTemp1
Integer iTemp1
Get Create (RefClass(cComChilkatRest)) To hoRest
If (Not(IsComObjectCreated(hoRest))) Begin
Send CreateComObject of hoRest
End
// URL: https://api.box.com/2.0/folders/FOLDER_ID/collaborations
Move True To iBTls
Move 443 To iPort
Move True To iBAutoReconnect
Get ComConnect Of hoRest "api.box.com" iPort iBTls iBAutoReconnect To iSuccess
If (iSuccess <> True) Begin
Get ComConnectFailReason Of hoRest To iTemp1
Showln "ConnectFailReason: " iTemp1
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get ComAddHeader Of hoRest "Authorization" "Bearer BOX_ACCESS_TOKEN" To iSuccess
Get Create (RefClass(cComChilkatStringBuilder)) To hoSbResponseBody
If (Not(IsComObjectCreated(hoSbResponseBody))) Begin
Send CreateComObject of hoSbResponseBody
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComFullRequestNoBodySb Of hoRest "GET" "/2.0/folders/FOLDER_ID/collaborations" vSbResponseBody To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
Get Create (RefClass(cComChilkatJsonObject)) To hoJsonResponse
If (Not(IsComObjectCreated(hoJsonResponse))) Begin
Send CreateComObject of hoJsonResponse
End
Get pvComObject of hoSbResponseBody to vSbResponseBody
Get ComLoadSb Of hoJsonResponse vSbResponseBody To iSuccess
Get ComIntOf Of hoJsonResponse "total_count" To iTotal_count
Move 0 To i
Get ComSizeOfArray Of hoJsonResponse "entries" To iCount_i
While (i < iCount_i)
Set ComI Of hoJsonResponse To i
Get ComStringOf Of hoJsonResponse "entries[i].type" To sType
Get ComStringOf Of hoJsonResponse "entries[i].id" To sId
Get ComStringOf Of hoJsonResponse "entries[i].created_by.type" To sCreated_byType
Get ComStringOf Of hoJsonResponse "entries[i].created_by.id" To sCreated_byId
Get ComStringOf Of hoJsonResponse "entries[i].created_by.name" To sCreated_byName
Get ComStringOf Of hoJsonResponse "entries[i].created_by.login" To sCreated_byLogin
Get ComStringOf Of hoJsonResponse "entries[i].created_at" To sCreated_at
Get ComStringOf Of hoJsonResponse "entries[i].modified_at" To sModified_at
Get ComIsNullOf Of hoJsonResponse "entries[i].expires_at" To iExpires_at
Get ComStringOf Of hoJsonResponse "entries[i].status" To sStatus
Get ComStringOf Of hoJsonResponse "entries[i].accessible_by.type" To sAccessible_byType
Get ComStringOf Of hoJsonResponse "entries[i].accessible_by.id" To sAccessible_byId
Get ComStringOf Of hoJsonResponse "entries[i].accessible_by.name" To sAccessible_byName
Get ComStringOf Of hoJsonResponse "entries[i].accessible_by.login" To sAccessible_byLogin
Get ComStringOf Of hoJsonResponse "entries[i].role" To sRole
Get ComStringOf Of hoJsonResponse "entries[i].acknowledged_at" To sAcknowledged_at
Get ComIsNullOf Of hoJsonResponse "entries[i].item" To iItem
Move i + 1 To i
Loop
End_Procedure
{
"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
}
]
}