Skip to content

Box Folder Locks: Unable to unlock folders #936

@jacquesvandermerwe

Description

@jacquesvandermerwe
  • [ x] I have checked that the SDK documentation doesn't solve my issue.
  • [x ] I have checked that the API documentation doesn't solve my issue.
  • [ x] I have searched the Box Developer Forums and my issue isn't already reported (or if it has been reported, I have attached a link to it, for reference).
  • [ x] I have searched Issues in this repo and my issue isn't already reported.

Description of the Issue

Java API is able to create a folder lock. But it isn't possible to unlock because it's using the wrong ID for the folder unlock operation.

In postman this sequence will work, but will fail in Java. See steps to reproduce.

Steps to Reproduce

Postman steps
Step 1: Create Lock

curl --location --request POST 'https://api.box.com/2.0/folder_locks' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <token>' \
--data-raw '{
  "locked_operations": {
    "move": true,
    "delete": true
  },
  "folder": {
    "type": "folder",
    "id": "150294091901"
  }
}'

Step 2: Get the Lock ID:

curl --location --request GET 'https://api.box.com/2.0/folder_locks?folder_id=150294091901' \
--header 'Authorization: Bearer <token>'

Step 3: Unlock

curl --location --request DELETE 'https://api.box.com/2.0/folder_locks/<folder_lock_id>' \
--header 'Authorization: Bearer <token>'

What I can see in Java is it looks like the BoxFolderLock's unlock method uses the folder id and not the lock id, which results in a failure and 404.

I saw the same failure behaviour in the CLI so it looks like it might be in the other SDK's as well.

Expected Behavior

Folder to be unlocked as per Postman steps

Error Message, Including Stack Trace

com.box.sdk.BoxAPIResponseException: The API returned an error code [404 | hmlz20gwif3mjx9k.0c100ff270357a5bffd49877560b1dd7] not_found - Not Found

Screenshots

Versions Used

Java SDK: 2.57.0
Java: 17.0.1

Metadata

Metadata

Labels

bugAdded to issues that describes SDK bug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions