Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
chakmangoo
3 years agoExplorer | Level 4
How to authenticate and stream a video file
Hello,
Question: How can I authenticate and stream a video file using api?
Context: I am working on a tool that should authenticate first to access a user file (I understand the token-ing process) and once I have access to a video file I want to stream it using C# dropbox api.
Thanks
5 Replies
- Greg-DB3 years ago
Dropbox Community Moderator
For information on how to use the authorization process, refer to the OAuth Guide and authorization documentation.
If you use the official Dropbox API v2 .NET SDK from C#, you do not need to implement all of the code for this process yourself. The SDK will do most of the work for you. You can find examples of using this here. For instance, you can find an example of getting and using a refresh token in the OauthBasic example (non-PKCE, meant for server-side apps) as well as in the OAuthPKCE example (PKCE, meant for client-side apps).
Using the Dropbox .NET SDK, you have a few options for accessing file data, such as for a video file. For example, you can call DownloadAsync to get the file data as a Stream. Or, you can call GetTemporaryLinkAsync to get a link to the file data.
In case you don't use the Dropbox .NET SDK, those are /2/files/download and /2/files/get_temporary_link respectively on the API itself.
- chakmangoo3 years agoExplorer | Level 4
Thanks you very much, Greg!
I follow-up question with some testing.
curl -X POST https://api.dropboxapi.com/2/file_requests/list_v2 --header "Authorization: Bearer <bearer_token>" --data "{\"limit\":1000}" --header "Dropbox-API-Select-User <user_token>
Upon trying a simple curl command in terminal to make sure that I get a valid response (list of files) from dropbox server, I get this response:
curl: (52) Empty reply from serverI have the files in the folder and token are not expired as well.
Any idea what could be wrong?
- Здравко3 years agoLegendary | Level 20
chakmangoo wrote:...
I have the files in the folder and token are not expired as well.
Any idea what could be wrong?
Hi chakmangoo,
I believe you about your files and probably there is nothing wrong with them. When you list them you will get back correct list, I believe too. 😉
In meantime, what do you see here? 🧐 Does it match to the result you got above? 🤔 If not, try play with that what you see there and post the details.
😁Hope this clarifies matter. 🙂
PS: When you post some example (either command line or code snippet), post a complete example letting reproduction of the possible issue and only mask private info (codes, tokens, etc.). Your command line end is missing above, so it's not clear why you got that result (likely something mistyped, like separators). There is some more wrong thing (in addition to wrong endpoint selection). Try to prototype endpoints calls here and here. Good luck.
- chakmangoo3 years agoExplorer | Level 4
- Greg-DB3 years ago
Dropbox Community Moderator
chakmangoo To clarify, the /2/file_requests/list_v2 is for listing "file requests", not actual files. If you want to list the actual files in a folder, you should use /2/files/list_folder and /2/files/list_folder/continue.
In any case, you shouldn't be receiving an "Empty reply from server" error; that may indicate an issue with your network connection. If you're still seeing that, please share the full code/steps to reproduce the issue, and the full output. It may be useful to use the "-v" flag on curl to get verbose output. Be sure to redact your access token though.
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!