Announcements

How do i differentiate enabled and disabled tracks with Spotify Web Api?

Reply
Highlighted

How do i differentiate enabled and disabled tracks with Spotify Web Api?

Casual Listener

I'm working with the Spotify Web Api in C# and I want to find out which tracks of my playlists are disabled. I know how to get all the FullTrack-Objects from my playlists, but I don't know which property tells me whether the track is disabled or enabled. Here's the link to the FullTrack-Object documentation: https://developer.spotify.com/documentation/web-api/reference/tracks/get-track/

In the following picture you see what i mean with disabled/enabled tracks: 
Screenshot 2020-10-17 141613.png

The disabled track 'Get Up' is greyed out and I can't play it. The enabled track 'Glitch Gang' is not greyed out and playable.
Note: Both tracks are not local!

A FullTrack-Object has the property is_playable... But that seems to be always null no matter what.

Then I tried to identify disabled tracks according to the available_markets property. I thought those would be null or empty when the track is disabled, but that wasn't the case. Tracks that were enabled sometimes also had an empty  array of available_markets.

So I'm stuck here... I don't know how or if it's even possible to differentiate disabled/enabled tracks with the Spotify Web Api. Does Anyone have a answer to that?

1 Reply
Highlighted

Re: How do i differentiate enabled and disabled tracks with Spotify Web Api?

Rock Star 16
Rock Star 16

Hey @JackDjTom, thanks for coming to the Community for help!

 

That's a good question! The 'is_playable' item will only be returned when the market is given in the request.

 

You can get the market the user is in with the 'me'-endpoint (country). Then pass that parameter on in your 'Get a Track'-request and you should get a boolean response for 'is_playable'.

 

Let me know if that works!

Have a great day,

Hubo

HuboRock Star 16
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.
SUGGESTED POSTS