I am able to authenticate and connect to the DropBox API and run team-members-list.
But I get the following error when I attempt to run team-members-remove with additional header and data in the request.
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url:
When adding try:
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Python code so far:
headers = {'Authorization': 'Bearer ' + TOKEN}
url = 'https://api.dropboxapi.com/2/team/members/remove'
data = {
"user": {".tag": "team_member_id", "team_member_id": userid},
"wipe_data": "true",
"transfer_dest_id": {".tag": "team_member_id", "team_member_id": adminid},
"transfer_admin_id": {".tag": "team_member_id", "team_member_id": adminid},
"keep_account": "false",
}
response = requests.post(url, data=data, headers=headers)
I have attempted some variations on the above, including:
headers = {'Authorization': 'Bearer ' + TOKEN, "Content-Type": "application/json" }
response = requests.post(url, json=data, headers=headers)
data = json.dump(data)
There are a few of these errors documented here, I've had a read of them and implemented the suggestions but still not been able to resolve this.
Any pointers greatly appreciated.
Background:
- Python 3.5.2
- Requests
- Dropbox for Business API