cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Back again with another edition of 'How we use Dropbox', so find out how Emma uses to-do lists to get it all done 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: 

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

Re: Business API v2

Steve M.
Dropboxer

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)

Re: Business API v2

Jamal B.1
New member | Level 1

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

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

Re: Business API v2

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!

Re: Business API v2

Greg-DB
Dropboxer

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

Re: Business API v2

Greg-DB
Dropboxer

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.

Re: Business API v2

Jamal B.1
New member | Level 1

It seems to work fine now 🙂

 

Thanks a lot!

Who's talking

Top contributors to this post

  • User avatar
    Jamal B.1 New member | Level 1
  • User avatar
    Greg-DB Dropboxer
What do Dropbox user levels mean?
Need more support?