You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.

Forum Discussion

Douglas16's avatar
Douglas16
Explorer | Level 4
9 years ago

Using token with API v2.

Hello guys, I learning about API v2, I was read the API commands and testing, so in my first commad teste I have a trouble, I try type the command:

 

curl -X POST https://api.dropboxapi.com/2/files/copy --header 'Authorization: Bearer null' --header 'Content-Type: application/json' --data '{"from_path":"","to_path":""}'  

 

and the output returns:  "Error in call to API function "files/copy": The given OAuth 2 access token is malformed."

 

I've been looking for this one from OAuth and the token, in the docs of dropbox I find the OAuth guide (https://www.dropbox.com/developers/reference/oauth-guide)...hear say that I should have a token to use this OAuth,  and to I can have a token I need to create an application...I would like to know if it is possible generate a token(https://blogs.dropbox.com/developers/2014/05/generate-an-access-token-for-your-own-account/) without create an application...just to I testing the commands of API...

 

Att:

I create an application in "My apps" section...but when I try to generate a token, 'generate access token' button in the settings section of the app I receive:  "You must be a team administrator to perform this operation."

 

So: what I need to do to be a team administrator?

 

 

Any help be apreciated, thanks in advanced!

 

  • Greg-DB's avatar
    Greg-DB
    9 years ago

    1. I'm not sure what part of my message are you referring to when you say "admins team", as I didn't use that exact term, but a Dropbox for Business team is a paid level of Dropbox service built for businesses. Some members of these teams are designated as "admins" and have additional abilities that other members don't. 

     

    2. Yes, using a Dropbox API (not Business) app you can generate a token for your own account. It sounds like you're not on a Business team or trying to use Business functionality, so you should use a normal Dropbox API app.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    In order to make an API call like /2/files/copy, you do need an access token, and to get an access token, you do need to register an app. (The app registration defines what kind of access the resulting access tokens enable.) There's no harm in registering an app though. You can rename or delete it later if you want.

     

    The first error you got indicates that the token you're passing (in your case the string "null") is invalid.

     

    The second error you got indicates that you registered a Dropbox Business API app, which can only be linked by Dropbox Business team admins. If you're on a Business team and need to be an admin, you'll need to request that change from an existing admin.

     

    If you don't need Dropbox Business API functionality though (e.g., /2/files/copy isn't only Business functionality) you can register a Dropbox API app, as opposed to a Dropbox Business API app, here:

     

    https://www.dropbox.com/developers/apps/create

    • Douglas16's avatar
      Douglas16
      Explorer | Level 4

      hmmm, ok I understood in parts...

       

      1 - what is exaclyt the dropbox business "admins team"  ? 

       

      2 -  So, if I create an Dropxbox API instead a Dropbox Business API I can generate a token without any problem?

       

       

      Thanks for your time,friend!

      • Greg-DB's avatar
        Greg-DB
        Icon for Dropbox Staff rankDropbox Staff

        1. I'm not sure what part of my message are you referring to when you say "admins team", as I didn't use that exact term, but a Dropbox for Business team is a paid level of Dropbox service built for businesses. Some members of these teams are designated as "admins" and have additional abilities that other members don't. 

         

        2. Yes, using a Dropbox API (not Business) app you can generate a token for your own account. It sounds like you're not on a Business team or trying to use Business functionality, so you should use a normal Dropbox API app.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,915 PostsLatest Activity: 7 hours ago
333 Following

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!