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"
CREATE PROCEDURE ChilkatSample
AS
BEGIN
DECLARE @hr int
DECLARE @iTmp0 int
DECLARE @sTmp0 nvarchar(4000)
DECLARE @rest int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.Rest', @rest OUT
IF @hr <> 0
BEGIN
PRINT 'Failed to create ActiveX component'
RETURN
END
DECLARE @success int
-- URL: https://api.box.com/2.0/folders/FOLDER_ID/collaborations
DECLARE @bTls int
SELECT @bTls = 1
DECLARE @port int
SELECT @port = 443
DECLARE @bAutoReconnect int
SELECT @bAutoReconnect = 1
EXEC sp_OAMethod @rest, 'Connect', @success OUT, 'api.box.com', STR(@port), STR(@bTls), STR(@bAutoReconnect)
IF STR(@success) <> 1
BEGIN
EXEC sp_OAGetProperty @rest, 'ConnectFailReason', @iTmp0 OUT
PRINT 'ConnectFailReason: ' + @iTmp0
EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
RETURN
END
EXEC sp_OAMethod @rest, 'AddHeader', @success OUT, 'Authorization', 'Bearer BOX_ACCESS_TOKEN'
DECLARE @sbResponseBody int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.StringBuilder', @sbResponseBody OUT
EXEC sp_OAMethod @rest, 'FullRequestNoBodySb', @success OUT, 'GET', '/2.0/folders/FOLDER_ID/collaborations', STR(@sbResponseBody)
IF STR(@success) <> 1
BEGIN
EXEC sp_OAGetProperty @rest, 'LastErrorText', @sTmp0 OUT
PRINT @sTmp0
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @sbResponseBody
RETURN
END
DECLARE @jsonResponse int
EXEC @hr = sp_OACreate 'Chilkat_9_5_0.JsonObject', @jsonResponse OUT
EXEC sp_OAMethod @jsonResponse, 'LoadSb', @success OUT, STR(@sbResponseBody)
DECLARE @total_count int
DECLARE @i int
DECLARE @count_i int
DECLARE @type nvarchar(4000)
DECLARE @id nvarchar(4000)
DECLARE @created_byType nvarchar(4000)
DECLARE @created_byId nvarchar(4000)
DECLARE @created_byName nvarchar(4000)
DECLARE @created_byLogin nvarchar(4000)
DECLARE @created_at nvarchar(4000)
DECLARE @modified_at nvarchar(4000)
DECLARE @expires_at int
DECLARE @status nvarchar(4000)
DECLARE @accessible_byType nvarchar(4000)
DECLARE @accessible_byId nvarchar(4000)
DECLARE @accessible_byName nvarchar(4000)
DECLARE @accessible_byLogin nvarchar(4000)
DECLARE @role nvarchar(4000)
DECLARE @acknowledged_at nvarchar(4000)
DECLARE @item int
EXEC sp_OAMethod @jsonResponse, 'IntOf', @total_count OUT, 'total_count'
SELECT @i = 0
EXEC sp_OAMethod @jsonResponse, 'SizeOfArray', @count_i OUT, 'entries'
WHILE STR(@i) < STR(@count_i)
BEGIN
EXEC sp_OASetProperty @jsonResponse, 'I', STR(@i)
EXEC sp_OAMethod @jsonResponse, 'StringOf', @type OUT, 'entries[i].type'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @id OUT, 'entries[i].id'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @created_byType OUT, 'entries[i].created_by.type'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @created_byId OUT, 'entries[i].created_by.id'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @created_byName OUT, 'entries[i].created_by.name'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @created_byLogin OUT, 'entries[i].created_by.login'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @created_at OUT, 'entries[i].created_at'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @modified_at OUT, 'entries[i].modified_at'
EXEC sp_OAMethod @jsonResponse, 'IsNullOf', @expires_at OUT, 'entries[i].expires_at'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @status OUT, 'entries[i].status'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @accessible_byType OUT, 'entries[i].accessible_by.type'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @accessible_byId OUT, 'entries[i].accessible_by.id'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @accessible_byName OUT, 'entries[i].accessible_by.name'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @accessible_byLogin OUT, 'entries[i].accessible_by.login'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @role OUT, 'entries[i].role'
EXEC sp_OAMethod @jsonResponse, 'StringOf', @acknowledged_at OUT, 'entries[i].acknowledged_at'
EXEC sp_OAMethod @jsonResponse, 'IsNullOf', @item OUT, 'entries[i].item'
SELECT @i = STR(@i) + 1
END
EXEC @hr = sp_OADestroy @rest
EXEC @hr = sp_OADestroy @sbResponseBody
EXEC @hr = sp_OADestroy @jsonResponse
END
GO
{
"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
}
]
}