One month down in 2025: How are your resolutions coming along? Check out how to get back on track here.
Forum Discussion
rajasimon
9 years agoExplorer | Level 3
How to get the valid url using dropbox api media endpoint.?
Goal is to play audio file from dropbox. Using dropbox python sdk I can get the folders and files but the `media` doesn't have valid file to play with.
def post(self, request):
request_body = json.loads(request.body)
path = request_body['path']
client = helper.dropbox_client(request.user.profile.dropbox_access_token)
media_info = client.media(path=path)
return JsonResponse(media_info, safe=True)
The `media_info` have the dict contains `url` but that is not valid means it not playing the content.
How do make that work ?
- Greg-DB
Dropbox Staff
[Cross-linking for reference: https://stackoverflow.com/questions/41807719/how-to-get-the-valid-url-using-dropbox-api-media-endpoint ]
Can you elaborate on what the issue you're running in to with the URL is? Are you getting an error?
- rajasimonExplorer | Level 3
After getting the response from Dropbox. I insert that url into audio player and seems it's not playing. The URL is not valid. If I copy paste that url into address bar it's not playing. My safari audio player simply shows Error.
Codes:
// HTML
<audio id="awesome-player" controls="" autoplay="">
<source id="mp3" src="" type="audio/mpeg">
Your browser does not support the audio tag.
</audio>// Javascript
var awesomePlayer = document.getElementById('awesome-player');
awesomePlayer.src=json.url;
awesomePlayer.play();- Greg-DB
Dropbox Staff
The API is returning a valid URL for me. Can you share a sample URL that's giving you trouble? Thanks in advance!
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.5,948 PostsLatest Activity: 6 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!