cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Are you interested in hearing how one of our Community members uses Dropbox for sailing trips? Read all about it here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to authenticate and stream a video file

How to authenticate and stream a video file

chakmangoo
Explorer | Level 4

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 5

Greg-DB
Dropbox Staff

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.

chakmangoo
Explorer | 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 server

 

I have the files in the folder and token are not expired as well. 

Any idea what could be wrong?

Здравко
Legendary | 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.

chakmangoo
Explorer | Level 4

This was a life saver!! Thanks 😄 

"Try to prototype endpoints calls here and here."

Greg-DB
Dropbox Staff

@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.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    chakmangoo Explorer | Level 4
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?