cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: Business API v2

Business API v2

Jamal B.1
New member | Level 1

Hi,

I can't seem to be able to use the Business API in its V2 incarnation.

First of all, what is the correct header to send?

Here it's Dropbox-API-Select-Team-Member and here it's X-Dropbox-Perform-As-Team-Member.

This works in v1:

url = 'https://content.dropboxapi.com/1/files_put/auto'
headers = {
'Authorization': 'Bearer ' + access_token,
'Content-Type': 'application/json',
'X-Dropbox-Perform-As-Team-Member': member_id
}
with open(local_filename, 'rb') as f:
r = requests.put(url + remote_path, headers=headers, data=f)

But this does not work in v2:

url = 'https://content.dropboxapi.com/2/files/upload'
headers = {
'Authorization': 'Bearer ' + access_token,
'Content-Type': 'application/octet-stream',
"Dropbox-API-Arg": "{\"path\":\"" + remote_path + "\"}",
'Dropbox-API-Select-Team-Member': member_id
}
with open(local_filename, 'rb') as f:
r = requests.post(url + headers=headers, data=f)

 

It fails with:

{
    "error": {
        ".tag": "invalid_access_token"
    },
    "error_summary": "invalid_access_token/"
}
6 Replies 6

Steve M.
Dropbox Staff

Sorry, the second link is to the old v1 documentation. We're going to clean that up to redirect to the right place.

So the first header (`Dropbox-API-Select-Team-Member`) should be right.

This line looks fairly wrong. Is that just a typo when you copied it here?

requests.post(url + headers=headers, data=f)

Jamal B.1
New member | Level 1

Sorry, yes it is a typo, it should be:

    r = requests.post(url, headers=headers, data=f)

Jamal B.1
New member | Level 1

I still get the error. Also with any API call on v2. Any idea of what I should change?

 

Thanks for your help!

Greg-DB
Dropbox Staff

It looks like this is a bug on our side. We're looking into it.

Greg-DB
Dropbox Staff

Apologies, the documentation is wrong. We'll get that fixed up. The header should be "Dropbox-API-Select-User". Please try that and let us know if you still see any issues.

Jamal B.1
New member | Level 1

It seems to work fine now 🙂

 

Thanks a lot!

Need more support?