Announcements

Help Wizard

Step 1

NEXT STEP

preview_url is null when calling api from local

preview_url is null when calling api from local

Country : JP

 

My Question or Issue

 

When I call the "Get a track" API from the Spotify Console (https://developer.spotify.com/console/get-track/), it returns a preview_url correctly.
However, when I copy the curl command shown in the Spotify Console and run it in the terminal on my PC, the preview_url is null for some songs.

 

Example curl command is 
```
curl -X "GET" "https://api.spotify.com/v1/tracks/44Ljlpy44mHvLJxcYUvTK0?market=JP" -H "Accept: application/json" -H "Content-Type: application/json" -H "Authorization: Bearer XXX"
```

 

The token I used in the above curl request is the token I got from our service using User Authorization.
When we used the token we got from "OAuth Token > GET TOKEN" in the Spotify Console, we were able to get the preview_url correctly with the curl command.

 

Are there any restrictions based on the access  region, or are there access restrictions for each token?
I would like to know the cause of not being able to get the preview_url.

 

Thanks!

Reply
3 Replies

You’ll find this with many of your track requests.  It doesn’t always return a preview URL.   Even though when you access that track in the app or the web it works.

 

i have developed a work around to fetch any missing previewURLs from a trackURI

@djk-tel may I ask you what the work around is? I also noticed this behavior and would need to fetch the preview_url from the spotify player in the case it is `null` in the API response.

Can you share your workaround? Facing the same issue

Suggested posts