metric
metric

Reputation: 303

Box Rest APIv2: Move File or Folder

There is a move operation in v1 API.

But is there any equivalent for v2 Rest API? There is copy function in V2, I tried to replace it as move but no love, with operation not permitted error or something like that:

curl https://api.box.com/2.0/files/FILE_ID/move \
  -H "Authorization: BoxAuth api_key=API_KEY&auth_token=AUTH_TOKEN" \
  -d '{"parent": {"id" : FOLDER_ID}}' \
  -X MOVE

Upvotes: 4

Views: 3085

Answers (1)

seanrose
seanrose

Reputation: 8695

You can do this by updating the parent of the item via a PUT request i.e.

curl https://api.box.com/2.0/files/FILE_ID \
    -H "Authorization: BoxAuth api_key=API_KEY&auth_token=AUTH_TOKEN" \
    -d '{"parent": {"id": "THE_NEW_PARENT_ID"}}' \
    -X PUT

Upvotes: 5

Related Questions