We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
NavPanchhi
4 years agoExplorer | Level 3
Simple file name retrieving using javascript
Hello, I'm really new to working with the dropbox API and was completely lost on how to retrieve file names. My main goal is to just have a list of the files' names that are uploaded to Dropbox disp...
NavPanchhi
4 years agoExplorer | Level 3
Sorry about that!
The issue that is appearing now is
Failed to load resource: the server responded with a status of 400 () https://api.dropboxapi.com/2/files/get_metadata
The entire code I have is this:
<script>
$.ajax({
type: 'POST',
data: "{\"include_deleted\":false,\"include_has_explicit_shared_members\":false,\"include_media_info\":false,\"path\":\"}",
contentType: "application/json",
beforeSend: function(xhr) {
xhr.setRequestHeader('Authorization', 'Bearer ***)
}, success: function(data){
console.log(data);
//process the JSON data etc
}
})
</script>
Greg-DB
Dropbox Community Moderator
4 years agoWhat's in the response body for that response with the 400 status code? It should contain a more specific error message.
- NavPanchhi4 years agoExplorer | Level 3
Is this what you mean?
- NavPanchhi4 years agoExplorer | Level 3
Here's more
Error in call to API function "files/get_metadata": Your app is not permitted to access this endpoint because it does not have the required scope 'files.metadata.read'. The owner of the app can enable the scope for the app using the Permissions tab on the App Console.
- Greg-DB4 years ago
Dropbox Community Moderator
This latest message is what I was referring to. It indicates that the call failed because your app does not have the necessary scope for that endpoint. You can enable the scope on the app's page on the App Console as described. Note that you'd need to then get a new access token as that change does not retroactively affect existing access tokens.
About 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!