Cut the Clutter: Test Ignore Files Feature - sign up to become a beta tester here.

Forum Discussion

Jamal B.1's avatar
Jamal B.1
New member | Level 1
10 years ago

Business API v2

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

Replies have been turned off for this discussion
  • 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's avatar
    Jamal B.1
    New member | Level 1
    10 years ago

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

        r = requests.post(url, headers=headers, data=f)
  • Jamal B.1's avatar
    Jamal B.1
    New member | Level 1
    10 years ago

    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's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago

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

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    10 years ago

    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.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.6,039 PostsLatest Activity: 13 hours ago
415 Following

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

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!