cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Re: Remove member and transfer files (409) Conflict

Remove member and transfer files (409) Conflict

DanR238
Explorer | Level 4
Go to solution

I'm trying to automate a leaver process and want to disable an active user and transfer their files to another active user. Using endpoint /members/remove I can successfully disable a user if this is all I'm requesting, but when I add to the request transfer of files as well (by using transfer_dest_id) API call fails with 'error: (409) Conflict' and I cannot find what is coflicting.
BTW I'm using API key with Team member management access and team_member_id as UserSelectorArg

Thanks in advance for any clues

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

If you're getting a status code, such as a 409, that means that you are receiving an HTTPS response. In the case of a 409 from the Dropbox API, there should always be some response body, but it looks like your HTTPS client isn't printing it out.

 

How have you been trying to access it exactly? It looks like this StackOverflow answer shows how you should be able to.

View solution in original post

5 Replies 5

Greg-DB
Dropbox Staff
Go to solution

Please print out the HTTPS response body for the failing API call. It should contain a more specific error indicating what the issue is.

DanR238
Explorer | Level 4
Go to solution

It doesn't look like it gets that far. This is an exception that happens at the point of invoking POST method and server returns: The remote server returned an error: (409) Conflict. The exception itself has Response property and it at it provides only the following:


IsMutuallyAuthenticated : False
Cookies : {}
Headers : {Transfer-Encoding, Connection, Content-Security-Policy, X-Dropbox-Request-Id...}
SupportsHeaders : True
ContentLength : -1
ContentEncoding :
ContentType : application/json
CharacterSet :
Server : nginx
LastModified : 26/03/2020 20:58:11
StatusCode : Conflict
StatusDescription : Conflict
ProtocolVersion : 1.1
ResponseUri : https://api.dropboxapi.com/2/team/members/remove
Method : POST
IsFromCache : False

 

This exception only happens if I have the transfer_dest_id in request body. If I remove it, the same request works OK, but without file transfer of course.

DanR238
Explorer | Level 4
Go to solution

It doesn't look like it gets that far. The error is an exception that happens at the point of invoking the POST method and server returns: The remote server returned an error: (409) Conflict. The exception itself has Response property but it only provides the following:
IsMutuallyAuthenticated : False
Cookies : {}
Headers : {Transfer-Encoding, Connection, Content-Security-Policy, X-Dropbox-Request-Id...}
SupportsHeaders : True
ContentLength : -1
ContentEncoding :
ContentType : application/json
CharacterSet :
Server : nginx
LastModified : 26/03/2020 20:58:11
StatusCode : Conflict
StatusDescription : Conflict
ProtocolVersion : 1.1
ResponseUri : https://api.dropboxapi.com/2/team/members/remove
Method : POST
IsFromCache : False

 

This exception only happens if I have the transfer_dest_id in request body. Here is what I'm doing to execute the API call:
I'm using Powershell Invoke-RestMethod cmdlet as below. The headers only include Authorization
Invoke-RestMethod -Uri "https://api.dropboxapi.com/2/team/members/remove" -Method 'POST' -ContentType "application/json" -Headers $_headers -Body <one of the two examples below>

 

Examples of request bodies for endpoint: /members/remove

API call fails with this body:
{"user": {".tag": "team_member_id","team_member_id": "<team_member_id>"},"wipe_data": false,"transfer_dest_id": {".tag": "team_member_id","team_member_id": "<team_member_id>"},"keep_account": false,"retain_team_shares": false}

API call successful - user is disabled:
{"user": {".tag": "team_member_id","team_member_id": "<team_member_id>"},"wipe_data": false,"keep_account": false,"retain_team_shares": false}

 

Interestingly, if I just disable a user via /members/remove and then try to use /members/move_former_member_files to transfer files I'm also receiving exactly the same (409) Conflict response. I guess I must be doing something incorrectly.

Greg-DB
Dropbox Staff
Go to solution

If you're getting a status code, such as a 409, that means that you are receiving an HTTPS response. In the case of a 409 from the Dropbox API, there should always be some response body, but it looks like your HTTPS client isn't printing it out.

 

How have you been trying to access it exactly? It looks like this StackOverflow answer shows how you should be able to.

DanR238
Explorer | Level 4
Go to solution

This is the clue I was looking for. Thank you very much! The Stack Overflow article allowed me to see the response, as you mentioned, although it wasn't the approved solution that helped me. In the end the actual problem, that generated the 409 Conflict exception, was related to the fact that when doing file transfer the request has to include admin id as well (error_summary: unspecified_transfer_admin_id). An example request body looks like this:

 

"{"user": {".tag": "team_member_id","team_member_id": "<team_member_id>"},"wipe_data": true,"transfer_dest_id": {".tag": "team_member_id","team_member_id": "<team_member_id>"},"transfer_admin_id": {".tag": "team_member_id","team_member_id": "<team_member_id>"},"keep_account": false,"retain_team_shares": false}"

 

Bit of a schoolboy error - need to read documentation more carefully.

In any case the problem is solved so thank you for your help!

 

Need more support?