0

In the Box API document, there is this section about "Move Folder into Another User’s Folder". I tried to follow the instructions there but it did not seem to work for me. This is what I did:

  1. I logged in as a co-admin of my Box account,
  2. I used the following command to move the root folder of another user to me:

    curl https://api.box.com/2.0/users/OTHER_USER_ID/folders/0 -k -H "Authorization: Bearer ACCESS_TOKEN" -d '{"owned_by":{"id":"ADMIN_USER_ID"}}' -X PUT
    
  3. This command returns

    400 error "bad_request" Invalid value ''{owned_by:{id:ADMIN_USER_ID}}''. Entity body should be a correctly nested resource attribue name\/value pair
    

Anyone has an idea about what I have done wrong ?

Soviut
  • 88,194
  • 49
  • 192
  • 260
  • Is the section "Move Folder into Another User’s Folder" in BOX API document "https://developers.box.com/docs/#users-move-folder-into-another-folder" accurate ? I got the feeling that this section is included in there by mistake. – user3868482 Aug 05 '14 at 04:00

1 Answers1

1

That functionality is a restricted permission, and it moves ALL the content from User1 into the other user's account. It is really meant for when an employee leaves and you need to transfer all their stuff over to their co-worker/boss/HR dept. In order to use it you have to:

  1. Be an admin in your enterprise with permission to see other users content.
  2. Have the other user be in your same enterprise.
  3. Set your application up with scope "Manage an enterprise". 3.a Make sure you log-in after you've done the above. If you don't your old auth token will have the old (lesser) permission.
  4. Then try the API calls.

You can alternatively use the As-User header to collab User2 into the folder as a co-owner, transfer ownership to User2, then remove User1 from the folder.

Peter
  • 2,551
  • 1
  • 14
  • 20