Move a folder to the trash. The recursive parameter must be included in order to delete folders that aren't empty. This example deletes the folder w/ id = 47885473705. An empty 204 response will be returned upon successful deletion. An error is thrown if the folder is not empty and the ‘recursive’ parameter is not included.
curl https://api.box.com/2.0/folders/47885473705?recursive=true \
-H "Authorization: Bearer BOX_ACCESS_TOKEN" \
-X DELETE
Use ChilkatAx-9.5.0-win32.pkg
Procedure Test
Handle hoRest
Boolean iSuccess
Boolean iBTls
Integer iPort
Boolean iBAutoReconnect
Variant vSbResponseBody
Handle hoSbResponseBody
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/47885473705?recursive=true
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 "DELETE" "/2.0/folders/47885473705?recursive=true" vSbResponseBody To iSuccess
If (iSuccess <> True) Begin
Get ComLastErrorText Of hoRest To sTemp1
Showln sTemp1
Procedure_Return
End
End_Procedure