Learn how to make the most out of the Dropbox Community here 💙.
Forum Discussion
NavPanchhi
3 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...
Greg-DB
Dropbox Staff
3 years agoThe Dropbox Chooser is a way to allow end-users to select specific files/folders and send them to the app. Based on your description, it sounds like that's not exactly what you're looking for. The Dropbox Embedder might be a better solution for you though. That lets you supply a (view-only) shared link, e.g., for a particular folder, and displays the contents of that folder on a web site.
Alternatively, if you need a more custom integration, you would need to use the Dropbox API instead. That allows you to programmatically list files and folders. For example, to list the contents of any particular folder, you would use the /2/files/list_folder[/continue] endpoints to list the contents of a specific path, and the results would include the name of each item. By the way, those are links to the documentation for the HTTPS endpoints themselves, but we recommend using one of the official SDKs if possible. Those have corresponding native methods for the HTTPS endpoints. The Getting Started and File Access guides may also helpful if you decide to use this option.
NavPanchhi
3 years agoExplorer | Level 3
Hello,
I am currently using the ajaz call below to achieve what I need but am still facing issues.
$.ajax({
type: 'POST',
url: 'https://api.dropboxapi.com/2/files/get_metadata',
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);
}
})
- Greg-DB3 years ago
Dropbox Staff
Please clarify what you mean when you say you are "still facing issues". For example, share any unexpected error or output.
- NavPanchhi3 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-DB3 years ago
Dropbox Staff
What's in the response body for that response with the 400 status code? It should contain a more specific error message.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,965 PostsLatest Activity: 6 hours ago
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!