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
varunpareek
28 days agoExplorer | Level 3
getting error when trying to download a file via api in react native
const AccessAsync = await AsyncStorage.getItem('Access');
const ACCESS_TOKEN = AccessAsync;
const DESTINATION_PATH = `${RNFS.LibraryDirectoryPath}/Data.zip`;
try {
const response = await axios.post(
{
path: '/BnD_Data/', // Path to the folder you want to list files in
recursive: false, // Set to true if you want to list files recursively
},
{
headers: {
Authorization: `Bearer ${ACCESS_TOKEN}`, // Replace with your access token
'Content-Type': 'application/json',
},
}
);
if (response.status == 200) {
const filesInDropbox = []
response.data.entries.forEach(element => {
console.log(element.name)
filesInDropbox.push(element.name)
});
console.log(filesInDropbox)
const dataZipExists = filesInDropbox.includes("Data.zip");
if (dataZipExists) {
try {
const headers = {
Authorization: `Bearer ${ACCESS_TOKEN}`,
'Dropbox-API-Arg': JSON.stringify({
path: '/BnD_Data/Data.zip',
}),
'Content-Type': 'application/octet-stream'
};
const response = await RNFetchBlob.config({
path: DESTINATION_PATH,
}).fetch('POST', DOWNLOAD_URL, headers);
} catch (error) {
}
}
}
} catch (error) {
}
this is my code where i try to download file using api but in this issue is if i upload file and then i try to download then file is being download but when second time i try to download file then getting error continuously until i re upload the same file and then download "error: [Error: The operation couldn’t be completed. Protocol error] " what's this issue
- Greg-DBDropbox Staff
I see you're getting an error "The operation couldn’t be completed. Protocol error". This is not actually an error from Dropbox itself, so unfortunately we can't offer much insight on that. It looks like it may be an issue with your network connection/stack, so you may need to refer to the support resources for the platform you're using.
- varunpareekExplorer | Level 3
First of all thanks for your reply. now i want to ask how it's possible when i upload any file on drop box using api, after that if i use this code then it's working fine and when i try this for second time it's showing error how it's possible. is there any issue with my code?
- Greg-DBDropbox Staff
It's not clear from this code what the issue may be. It seems like it may be a problem with the platform or network client itself.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,882 PostsLatest Activity: 3 years agoIf 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!