We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
zencop731
3 years agoExplorer | Level 3
Trying to move files in Powershell gives Error 404
Good day all, I am new to dropbox development and am trying to do something simple, post a file to one directory (done) and then have another script move that file to another directory after downloading it. I am just working on the move piece and keep getting a 404 error and nothing seems to work. And the file.contents.write properties have been set as well. If I simply do a file upload to the second folder, that works, but not a move.
$authorization = "Bearer $AccessToken"
# move file to other folder
$arg = '{"allow_ownership_transfer":false,"allow_shared_folder":false,"autorename":false,"from_path":"/incoming","to_path":"/completed"}"'
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"
$headers.Add("Authorization", $authorization)
$headers.Add("Content-Type", 'application/json')
$headers.Add("Dropbox-API-Arg", $arg)
Invoke-RestMethod `
-Uri https://api.dropboxapi.com/2/files/move_v2 `
-Headers $headers
1 Reply
- Greg-DB3 years ago
Dropbox Community Moderator
Make sure you set the HTTP method to "POST". You don't have that specified so it looks like the client is defaulting to a value not valid for accessing this Dropbox API endpoint.
Also, note that the /2/files/move_v2 endpoint is an "RPC" style endpoint, so it requires the parameters in the request body, not the "Dropbox-API-Arg" request header.
By the way, it looks like you have an extra quote character at the end of your arg string.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!