One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
sjn001tvh
4 years agoExplorer | Level 3
api dropbox_find_file
Greetings, I have experienced a rather perplexing situation. I'm using Pipedream workflow steps to initiate Dropbox api calls, and they have been working perfectly. I have a Dropbox directory where I place some text files that I use as parameter files. I have successfully processed and downloaded one file from the directory in one of my workflows, but in another workflow, using the same calls as before but with a different filename, it returns "file not found". I even tried the same filename as before, and got the same results. I successfully executed the call to list files in the folder and the file exists, and I tried to use that reference to the file and still file not found.
Here's the code that I use in the first workflow (which works fine),
-------------------------------------------
async (events, steps, auths) => {
const fetch = require('isomorphic-fetch');
const { Dropbox } = require('dropbox');
const dbx = new Dropbox({
accessToken: auths.dropbox.oauth_access_token,
fetch
});
var filterFilesInResults = function (results) {
var filteredResults = [];
for (var k in results) {
if (results[k] && "file" == results[k].metadata[".tag"]){
filteredResults.push( results[k]);
}
}
return filteredResults;
};
this.filepath = params.file_path || ''
try {
this.resp = await dbx.filesSearch({
query: params.query,
path: this.filepath,
mode: params.search_mode,
});
var filtered = filterFilesInResults(this.resp.matches);
this.resp.matches = filtered;
} catch (err) {
this.err = err;
}
}
------------------------------------------
This works great and I'm able to process the information from the file.
However, when I implemented the same call in a different workflow, using the same code and changing the name of the file, the following error occurs.
steps.dropbox_find_file.filepath:/workflowapps_paramfiles/clickup_api_params.def
error:Error in call to API function "files/search": request body: missing required field 'query'
I'm using the same code as shown above, but simply changing the name of the file. And yet each time I execute the code, I get the response error shown above. Like I mentioned before I have tried listing the files in the folder, and I select the file from the list returned by the call to dropbox_list_folder, but the same error occurs.
What am I missing that triggers this error, when I haven't changed any of the code, but only the name of the file that I want to select?
Any input would be appreciated. Thanks.
- Greg-DB
Dropbox Staff
The error from the Dropbox API here "Error in call to API function "files/search": request body: missing required field 'query'" indicates that the call was rejected because it did not include the required parameter "query".
From the code you shared though, I see you are setting the "query" parameter for the "filesSearch" method, so the SDK should be setting that in the request.
Can you check what the value of 'params.query' is? If it's not defined, that could result in this issue.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,949 PostsLatest Activity: 2 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!