You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

Greater Than Consulting's avatar
Greater Than Consulting
Explorer | Level 3
8 months ago

move_batch API Request getting "relocation_error" "conflict" status

First let me start off by saying that I am not a coder. I just see patterns and typically figure out how to make things work. 

 

I'm using Zapier to do a number of automations. One task that I'm needing automated is the moving of all files from one folder to another. Zapier does not have a clickable function to do this, so I have to use the "API Request in Dropbox" function. It took me a little while to get it sorted out. It appears to me that the API call is being submitting successfully to Dropbox. However, no files are being moved

 

I'm getting the following response body:
{".tag": "async_job_id", "async_job_id": "dbjid:AABI_8Adka7HHdIhvnANDgxZMG9kXDqa6_M1KyZTm30Jbhz2aiVxD8VFgfzmP_mtp6rDex6Tnrl9oWhAaUVLdXmV"}

When I POST to https://api.dropboxapi.com/2/files/move_batch/check_v2 with the job id info the response body is:
{".tag": "complete", "entries": [{".tag": "failure", "failure": {".tag": "relocation_error", "relocation_error": {".tag": "to", "to": {".tag": "conflict", "conflict": {".tag": "folder"}}}}}]}
 
 
 ---------
To provide as much info as possible, here are the logs for the initial move_batch_v2 API post. I just copied and pasted from the "test results" window in zapier. I notice some of the label info is doubled when pasting below.:::
request
request
Request Method
method
POST
Request Querystring
querystring
 
Request Headers
headers
Request Headers Content Type
content-type
application/json
Request Body
body
{ "allow_ownership_transfer": false, "autorename": false, "entries": [ { "from_path": "/Greater Than Consulting/Offers/SocialBusinessBot/Clients/RV Shepherd/Topic 1 Used", "to_path": "/Greater Than Consulting/Offers/SocialBusinessBot/Clients/RV Shepherd/Topic 1" } ] }
data
data
Request Data Allow Ownership Transfer
allow_ownership_transfer
false
Request Data Autorename
autorename
false
entries
entries
1
1
from_path
from_path
/Greater Than Consulting/Offers/SocialBusinessBot/Clients/RV Shepherd/Topic 1 Used
to_path
to_path
/Greater Than Consulting/Offers/SocialBusinessBot/Clients/RV Shepherd/Topic 1
response
response
Response Status
status
200
Response Headers
headers
Response Headers Cache Control
cache-control
no-cache
Response Headers Connection
connection
close
Response Headers Content Encoding
content-encoding
gzip
Response Headers Content Type
content-type
application/json
Response Headers Date
date
Fri, 05 Apr 2024 06:28:34 GMT
Response Headers Server
server
envoy
Response Headers Transfer Encoding
transfer-encoding
chunked
Response Headers Vary
vary
Accept-Encoding
Response Headers X Content Type Options
x-content-type-options
nosniff
Response Headers X Dropbox Request ID
x-dropbox-request-id
4cdb7db0c2314dd3a586d95167b5e410
Response Headers X Dropbox Response Origin
x-dropbox-response-origin
far_remote
Response Headers X Frame Options
x-frame-options
SAMEORIGIN
Response Headers X Server Response Time
x-server-response-time
68
Response Body
body
{".tag": "async_job_id", "async_job_id": "dbjid:AABI_8Adka7HHdIhvnANDgxZMG9kXDqa6_M1KyZTm30Jbhz2aiVxD8VFgfzmP_mtp6rDex6Tnrl9oWhAaUVLdXmV"}
data
data
Response Data Tag
.tag
async_job_id
Response Data Async Job Id
async_job_id
dbjid:AABI_8Adka7HHdIhvnANDgxZMG9kXDqa6_M1KyZTm30Jbhz2aiVxD8VFgfzmP_mtp6rDex6Tnrl9oWhAaUVLdXmV
  • You can see what the result/error means by referring to the documentation, and clicking through the nested types as needed. For instance, from the /2/files/move_batch_v2 documentation, this 'failure/relocation_error/to/conflict/folder' for the entry in the complete.entries means that the entry was not moved because there's a folder in the way.

     

    That is, in this case, the item at "/Greater Than Consulting/Offers/SocialBusinessBot/Clients/RV Shepherd/Topic 1 Used" was not moved to "/Greater Than Consulting/Offers/SocialBusinessBot/Clients/RV Shepherd/Topic 1", because there's already a folder at the path "/Greater Than Consulting/Offers/SocialBusinessBot/Clients/RV Shepherd/Topic 1".

     

    I see that you said you're trying to make something for the "moving of all files from one folder to another". Note however that the Dropbox API does not directly offer a way to do that. I'll pass this along as a feature request, but I can't promise if or when that might be implemented.

     

    The Dropbox API, such as the /2/files/move_batch_v2 endpoint, allows you to specify one or more items themselves to move. For instance, if "/Greater Than Consulting/Offers/SocialBusinessBot/Clients/RV Shepherd/Topic 1 Used" refers to a folder, then specifying that as the "from_path" when calling the /2/files/move_batch_v2 endpoint would move that folder itself (including its contents), not just all of the contents of that folder.

     

    And the "to_path" would need to be the full path (including both the parent folder path as well as the file or folder name of the destination inside that parent folder) of where you want the item moved to.

     

    So, if you want to move all of the files inside one folder to be inside another already existing folder, you would need to send a list of entries with an object containing a "from_path" and a "to_path" with the full path for each file you want to move when calling the /2/files/move_batch_v2 endpoint. The API v2 Explorer can be useful for prototyping/testing calls like this. You can click "Add" multiple times to create multiple objects in the "entries" list, and fill those in and click "Show Code" to see what the resulting code would look like.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    You can see what the result/error means by referring to the documentation, and clicking through the nested types as needed. For instance, from the /2/files/move_batch_v2 documentation, this 'failure/relocation_error/to/conflict/folder' for the entry in the complete.entries means that the entry was not moved because there's a folder in the way.

     

    That is, in this case, the item at "/Greater Than Consulting/Offers/SocialBusinessBot/Clients/RV Shepherd/Topic 1 Used" was not moved to "/Greater Than Consulting/Offers/SocialBusinessBot/Clients/RV Shepherd/Topic 1", because there's already a folder at the path "/Greater Than Consulting/Offers/SocialBusinessBot/Clients/RV Shepherd/Topic 1".

     

    I see that you said you're trying to make something for the "moving of all files from one folder to another". Note however that the Dropbox API does not directly offer a way to do that. I'll pass this along as a feature request, but I can't promise if or when that might be implemented.

     

    The Dropbox API, such as the /2/files/move_batch_v2 endpoint, allows you to specify one or more items themselves to move. For instance, if "/Greater Than Consulting/Offers/SocialBusinessBot/Clients/RV Shepherd/Topic 1 Used" refers to a folder, then specifying that as the "from_path" when calling the /2/files/move_batch_v2 endpoint would move that folder itself (including its contents), not just all of the contents of that folder.

     

    And the "to_path" would need to be the full path (including both the parent folder path as well as the file or folder name of the destination inside that parent folder) of where you want the item moved to.

     

    So, if you want to move all of the files inside one folder to be inside another already existing folder, you would need to send a list of entries with an object containing a "from_path" and a "to_path" with the full path for each file you want to move when calling the /2/files/move_batch_v2 endpoint. The API v2 Explorer can be useful for prototyping/testing calls like this. You can click "Add" multiple times to create multiple objects in the "entries" list, and fill those in and click "Show Code" to see what the resulting code would look like.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,882 PostsLatest Activity: 22 hours ago
325 Following

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 or Facebook.

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!