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

milesmajefski's avatar
milesmajefski
New member | Level 2
7 years ago

Accessing get_metadata endpoint without Dropbox Javascript package

For fun, I'm making a cataloging web app using asp.net core 2.1 MVC and javascript.  I don't need a frontend framework, so I don't want to bring in the whole NodeJS npm situation into this project.  ...
  • Greg-DB's avatar
    7 years ago

    While we recommend using the official libraries, it's not required. You can always call the Dropbox API HTTPS endpoints directly if you prefer. The documentation covers the requirements for each endpoint, and includes an example of calling using curl, e.g., for /2/files/get_metadata.

    It looks like you're running in to a CORS issue though, due to your use of `credentials: 'include'`. Dropbox API calls, such as for /2/files/get_metadata, are authenticated using Dropbox API access tokens, not the browser's credentials. You need to supply the access token in the "Authorization" header as a "Bearer" token. (Also, the parameters should be a JSON string in the body.)

    So, you code should look more like this:

                fetch(apiURL, {
                    method: 'post',
                    headers: {
                        "Authorization": "Bearer ACCESS_TOKEN_HERE",
                        "Content-type": "application/json; charset=UTF-8"
                    },
                    body: JSON.stringify(reqData),
                })

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,887 PostsLatest Activity: 14 minutes ago
326 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!