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
arpit2011
5 years agoExplorer | Level 4
Error 400 with Download API
Hello Experts,
I have a business requirement in which files could directly be uploaded from dropbox through my javascript based web application(SAPUI5). My application is SAP UI5 based web appl...
- 5 years ago
arpit2011 I see that Здравко has already helpfully answered your questions. To confirm, a shared link is not a path, which is why you got that first error. A path would look like "/folder/file.ext".
You can use the ID instead as you attempted, but the /2/files/download endpoint will return that 'path/not_found' error if the app doesn't have access to the identified file. For example, the access token may be for a different account, as Здравко said, or if the app is registered for the "app folder" access type, the app won't have access to the file if it exists outside its app folder.
As for "How to get the access code in runtime through JS", getting an access token does initially require some manual user interaction, but you can store and re-use it after that. I recommend reading the OAuth Guide and authorization documentation for information on how that all works.
By the way, you should never share your access token, as you did here in your images. I've redacted them for you, but for the sake of security, you should disable that access token since it was posted publicly. You can do so by revoking access to the app entirely, if the access token is for your account, here. Or, you can disable just this access token using the API.
arpit2011
Explorer | Level 4
Hi @Здравко,
Thanks for helping me out.
I am passing the ID which I am getting from the chooser function. I am not sure why the ID is being reassigned :(
Also, I do not want to download the file instead I want to store the files in SAP servers. The reason I am calling the download API is I am trying to get the file data in arrayBuffer/BLOB so that I can upload the same in SAP servers. I hope this is the right way to get the file data.
I passed the access token after generating from the App console. Is there a way or an API to get the token at the runtime?
Thanks again for helping me.
Best regards,
Arpit
Здравко
5 years agoLegendary | Level 20
arpit2011 wrote:
...Also, I do not want to download the file instead I want to store the files in SAP servers. The reason I am calling the download API is I am trying to get the file data in arrayBuffer/BLOB so that I can upload the same in SAP servers. I hope this is the right way to get the file data.
...
Yes, yes, ... Of course.
I'm not saying you have to use my command. This is just for example that you can access the target file using the shared link itself, nothing more. As I have mentioned, you can use everything else ( "... or equivalent call" ). Use whatever is convenient for you to get a picture from link, for example (or anything else from wherever else), in arrayBuffer/BLOB to upload the same wherever you want. 😉 That's it.
Hope this adds additional clarity.
- arpit20115 years agoExplorer | Level 4
Здравко wrote:
arpit2011 wrote:
...Also, I do not want to download the file instead I want to store the files in SAP servers. The reason I am calling the download API is I am trying to get the file data in arrayBuffer/BLOB so that I can upload the same in SAP servers. I hope this is the right way to get the file data.
...Yes, yes, ... Of course.
I'm not saying you have to use my command. This is just for example that you can access the target file using the shared link itself, nothing more. As I have mentioned, you can use everything else ( "... or equivalent call" ). Use whatever is convenient for you to get a picture from link, for example (or anything else from wherever else), in arrayBuffer/BLOB to upload the same wherever you want. 😉 That's it.
Hope this adds additional clarity.
Thanks again.
Still, the doubt persists. I still cannot pass the ID into the download API.
Also, How to get the access code in runtime through JS?
Thanks,
Arpit
- Greg-DB5 years agoDropbox Staff
arpit2011 I see that Здравко has already helpfully answered your questions. To confirm, a shared link is not a path, which is why you got that first error. A path would look like "/folder/file.ext".
You can use the ID instead as you attempted, but the /2/files/download endpoint will return that 'path/not_found' error if the app doesn't have access to the identified file. For example, the access token may be for a different account, as Здравко said, or if the app is registered for the "app folder" access type, the app won't have access to the file if it exists outside its app folder.
As for "How to get the access code in runtime through JS", getting an access token does initially require some manual user interaction, but you can store and re-use it after that. I recommend reading the OAuth Guide and authorization documentation for information on how that all works.
By the way, you should never share your access token, as you did here in your images. I've redacted them for you, but for the sake of security, you should disable that access token since it was posted publicly. You can do so by revoking access to the app entirely, if the access token is for your account, here. Or, you can disable just this access token using the API.
- arpit20115 years agoExplorer | Level 4
Greg-DB wrote:arpit2011 I see that Здравко has already helpfully answered your questions. To confirm, a shared link is not a path, which is why you got that first error. A path would look like "/folder/file.ext".
You can use the ID instead as you attempted, but the /2/files/download endpoint will return that 'path/not_found' error if the app doesn't have access to the identified file. For example, the access token may be for a different account, as Здравко said, or if the app is registered for the "app folder" access type, the app won't have access to the file if it exists outside its app folder.
As for "How to get the access code in runtime through JS", getting an access token does initially require some manual user interaction, but you can store and re-use it after that. I recommend reading the OAuth Guide and authorization documentation for information on how that all works.
By the way, you should never share your access token, as you did here in your images. I've redacted them for you, but for the sake of security, you should disable that access token since it was posted publicly. You can do so by revoking access to the app entirely, if the access token is for your account, here. Or, you can disable just this access token using the API.
Thank you Greg-DB for your help. I was able to successfully run the oAuth flow and fetch the token.
Thanks for highlighting about the token. I have created a new app and deleted the old one.
I would need one more help. Now that my integration is successful, I would like to know which and why of the following plans would be perfect for me. Please note that my only requirement is to Host an application which would help me use Dropbox Chooser and maintain redirect URLs for oAuth flow. I do not want much storage too but I would be using this dropbox application in production. The end-users should be able to run the OAuth flow.
Thanks
Arpit
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,914 PostsLatest Activity: 52 minutes 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!