Used to create a copy of a folder in another folder. The original version of the folder will not be altered. The a response status code of 202 is expected for success.
curl https://api.box.com/2.0/folders/FOLDER_ID/copy \
-H "Authorization: Bearer BOX_ACCESS_TOKEN" \
-d '{"parent": {"id" : DESTINATION_FOLDER_ID}}' \
-X POST
integer li_rc
oleobject loo_Rest
integer li_Success
integer li_BTls
integer li_Port
integer li_BAutoReconnect
oleobject loo_Json
oleobject loo_SbRequestBody
oleobject loo_SbResponseBody
oleobject loo_JsonResponse
string ls_Type
string ls_Id
string ls_Sequence_id
string ls_Etag
string ls_Name
string ls_Created_at
string ls_Modified_at
string ls_Description
integer li_Size
integer li_Path_collectionTotal_count
string ls_Created_byType
string ls_Created_byId
string ls_Created_byName
string ls_Created_byLogin
string ls_Modified_byType
string ls_Modified_byId
string ls_Modified_byName
string ls_Modified_byLogin
string ls_Owned_byType
string ls_Owned_byId
string ls_Owned_byName
string ls_Owned_byLogin
string ls_Shared_linkUrl
integer li_Shared_linkDownload_url
integer li_Shared_linkVanity_url
integer li_Shared_linkIs_password_enabled
integer li_Shared_linkUnshared_at
integer li_Shared_linkDownload_count
integer li_Shared_linkPreview_count
string ls_Shared_linkAccess
integer li_Shared_linkPermissionsCan_download
integer li_Shared_linkPermissionsCan_preview
string ls_Folder_upload_emailAccess
string ls_Folder_upload_emailEmail
string ls_ParentType
string ls_ParentId
integer li_ParentSequence_id
integer li_ParentEtag
string ls_ParentName
string ls_Item_status
integer li_Item_collectionTotal_count
integer li_Item_collectionOffset
integer li_Item_collectionLimit
integer i
integer li_Count_i
integer li_Sequence_id_bool
integer li_Etag_bool
string ls_Sha1
loo_Rest = create oleobject
li_rc = loo_Rest.ConnectToNewObject("Chilkat_9_5_0.Rest")
if li_rc < 0 then
destroy loo_Rest
MessageBox("Error","Connecting to COM object failed")
return
end if
// URL: https://api.box.com/2.0/folders/FOLDER_ID/copy
li_BTls = 1
li_Port = 443
li_BAutoReconnect = 1
li_Success = loo_Rest.Connect("api.box.com",li_Port,li_BTls,li_BAutoReconnect)
if li_Success <> 1 then
Write-Debug "ConnectFailReason: " + string(loo_Rest.ConnectFailReason)
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
return
end if
loo_Json = create oleobject
li_rc = loo_Json.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_Json.UpdateNumber("parent.id","DESTINATION_FOLDER_ID")
loo_Rest.AddHeader("Authorization","Bearer BOX_ACCESS_TOKEN")
loo_SbRequestBody = create oleobject
li_rc = loo_SbRequestBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
loo_Json.EmitSb(loo_SbRequestBody)
loo_SbResponseBody = create oleobject
li_rc = loo_SbResponseBody.ConnectToNewObject("Chilkat_9_5_0.StringBuilder")
li_Success = loo_Rest.FullRequestSb("POST","/2.0/folders/FOLDER_ID/copy",loo_SbRequestBody,loo_SbResponseBody)
if li_Success <> 1 then
Write-Debug loo_Rest.LastErrorText
destroy loo_Rest
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
return
end if
loo_JsonResponse = create oleobject
li_rc = loo_JsonResponse.ConnectToNewObject("Chilkat_9_5_0.JsonObject")
loo_JsonResponse.LoadSb(loo_SbResponseBody)
ls_Type = loo_JsonResponse.StringOf("type")
ls_Id = loo_JsonResponse.StringOf("id")
ls_Sequence_id = loo_JsonResponse.StringOf("sequence_id")
ls_Etag = loo_JsonResponse.StringOf("etag")
ls_Name = loo_JsonResponse.StringOf("name")
ls_Created_at = loo_JsonResponse.StringOf("created_at")
ls_Modified_at = loo_JsonResponse.StringOf("modified_at")
ls_Description = loo_JsonResponse.StringOf("description")
li_Size = loo_JsonResponse.IntOf("size")
li_Path_collectionTotal_count = loo_JsonResponse.IntOf("path_collection.total_count")
ls_Created_byType = loo_JsonResponse.StringOf("created_by.type")
ls_Created_byId = loo_JsonResponse.StringOf("created_by.id")
ls_Created_byName = loo_JsonResponse.StringOf("created_by.name")
ls_Created_byLogin = loo_JsonResponse.StringOf("created_by.login")
ls_Modified_byType = loo_JsonResponse.StringOf("modified_by.type")
ls_Modified_byId = loo_JsonResponse.StringOf("modified_by.id")
ls_Modified_byName = loo_JsonResponse.StringOf("modified_by.name")
ls_Modified_byLogin = loo_JsonResponse.StringOf("modified_by.login")
ls_Owned_byType = loo_JsonResponse.StringOf("owned_by.type")
ls_Owned_byId = loo_JsonResponse.StringOf("owned_by.id")
ls_Owned_byName = loo_JsonResponse.StringOf("owned_by.name")
ls_Owned_byLogin = loo_JsonResponse.StringOf("owned_by.login")
ls_Shared_linkUrl = loo_JsonResponse.StringOf("shared_link.url")
li_Shared_linkDownload_url = loo_JsonResponse.IsNullOf("shared_link.download_url")
li_Shared_linkVanity_url = loo_JsonResponse.IsNullOf("shared_link.vanity_url")
li_Shared_linkIs_password_enabled = loo_JsonResponse.BoolOf("shared_link.is_password_enabled")
li_Shared_linkUnshared_at = loo_JsonResponse.IsNullOf("shared_link.unshared_at")
li_Shared_linkDownload_count = loo_JsonResponse.IntOf("shared_link.download_count")
li_Shared_linkPreview_count = loo_JsonResponse.IntOf("shared_link.preview_count")
ls_Shared_linkAccess = loo_JsonResponse.StringOf("shared_link.access")
li_Shared_linkPermissionsCan_download = loo_JsonResponse.BoolOf("shared_link.permissions.can_download")
li_Shared_linkPermissionsCan_preview = loo_JsonResponse.BoolOf("shared_link.permissions.can_preview")
ls_Folder_upload_emailAccess = loo_JsonResponse.StringOf("folder_upload_email.access")
ls_Folder_upload_emailEmail = loo_JsonResponse.StringOf("folder_upload_email.email")
ls_ParentType = loo_JsonResponse.StringOf("parent.type")
ls_ParentId = loo_JsonResponse.StringOf("parent.id")
li_ParentSequence_id = loo_JsonResponse.IsNullOf("parent.sequence_id")
li_ParentEtag = loo_JsonResponse.IsNullOf("parent.etag")
ls_ParentName = loo_JsonResponse.StringOf("parent.name")
ls_Item_status = loo_JsonResponse.StringOf("item_status")
li_Item_collectionTotal_count = loo_JsonResponse.IntOf("item_collection.total_count")
li_Item_collectionOffset = loo_JsonResponse.IntOf("item_collection.offset")
li_Item_collectionLimit = loo_JsonResponse.IntOf("item_collection.limit")
i = 0
li_Count_i = loo_JsonResponse.SizeOfArray("path_collection.entries")
do while i < li_Count_i
loo_JsonResponse.I = i
ls_Type = loo_JsonResponse.StringOf("path_collection.entries[i].type")
ls_Id = loo_JsonResponse.StringOf("path_collection.entries[i].id")
li_Sequence_id_bool = loo_JsonResponse.IsNullOf("path_collection.entries[i].sequence_id")
li_Etag_bool = loo_JsonResponse.IsNullOf("path_collection.entries[i].etag")
ls_Name = loo_JsonResponse.StringOf("path_collection.entries[i].name")
i = i + 1
loop
i = 0
li_Count_i = loo_JsonResponse.SizeOfArray("item_collection.entries")
do while i < li_Count_i
loo_JsonResponse.I = i
ls_Type = loo_JsonResponse.StringOf("item_collection.entries[i].type")
ls_Id = loo_JsonResponse.StringOf("item_collection.entries[i].id")
ls_Sequence_id = loo_JsonResponse.StringOf("item_collection.entries[i].sequence_id")
ls_Etag = loo_JsonResponse.StringOf("item_collection.entries[i].etag")
ls_Sha1 = loo_JsonResponse.StringOf("item_collection.entries[i].sha1")
ls_Name = loo_JsonResponse.StringOf("item_collection.entries[i].name")
i = i + 1
loop
destroy loo_Rest
destroy loo_Json
destroy loo_SbRequestBody
destroy loo_SbResponseBody
destroy loo_JsonResponse
{
"type": "folder",
"id": "11446498",
"sequence_id": "1",
"etag": "1",
"name": "Pictures",
"created_at": "2012-12-12T10:53:43-08:00",
"modified_at": "2012-12-12T11:15:04-08:00",
"description": "Some pictures I took",
"size": 629644,
"path_collection": {
"total_count": 1,
"entries": [
{
"type": "folder",
"id": "0",
"sequence_id": null,
"etag": null,
"name": "All Files"
}
]
},
"created_by": {
"type": "user",
"id": "17738362",
"name": "sean rose",
"login": "sean@box.com"
},
"modified_by": {
"type": "user",
"id": "17738362",
"name": "sean rose",
"login": "sean@box.com"
},
"owned_by": {
"type": "user",
"id": "17738362",
"name": "sean rose",
"login": "sean@box.com"
},
"shared_link": {
"url": "https://www.box.com/s/vspke7y05sb214wjokpk",
"download_url": null,
"vanity_url": null,
"is_password_enabled": false,
"unshared_at": null,
"download_count": 0,
"preview_count": 0,
"access": "open",
"permissions": {
"can_download": true,
"can_preview": true
}
},
"folder_upload_email": {
"access": "open",
"email": "upload.Picture.k13sdz1@u.box.com"
},
"parent": {
"type": "folder",
"id": "0",
"sequence_id": null,
"etag": null,
"name": "All Files"
},
"item_status": "active",
"item_collection": {
"total_count": 1,
"entries": [
{
"type": "file",
"id": "5000948880",
"sequence_id": "3",
"etag": "3",
"sha1": "134b65991ed521fcfe4724b7d814ab8ded5185dc",
"name": "tigers.jpeg"
}
],
"offset": 0,
"limit": 100
}
}