Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

milesmajefski's avatar
milesmajefski
New member | Level 2
8 years ago
Solved

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
    8 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.

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, Facebook or Instagram.

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!