[GH-ISSUE #486] TrackLink::id can be null #158

Closed
opened 2026-02-27 20:23:28 +03:00 by kerem · 2 comments
Owner

Originally created by @aome510 on GitHub (Aug 1, 2024).
Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/486

id field in TrackLink can be null.

To reproduce, call

curl --request GET \
      --url "https://api.spotify.com/v1/albums/5dIJ97uGTWrNmw6QRwMnRo" \
      --header 'Authorization: Bearer $TOKEN'

Expected response:

{"album_type":"single","total_tracks":1,"available_markets":["JP"],"external_urls":{"spotify":"https://open.spotify.com/album/5dIJ97uGTWrNmw6QRwMnRo"},"href":"https://api.spotify.com/v1/albums/5dIJ97uGTWrNmw6QRwMnRo","id":"5dIJ97uGTWrNmw6QRwMnRo","images":[{"url":"https://i.scdn.co/image/ab67616d0000b273cbd185b2883c3e898afe3d48","height":640,"width":640},{"url":"https://i.scdn.co/image/ab67616d00001e02cbd185b2883c3e898afe3d48","height":300,"width":300},{"url":"https://i.scdn.co/image/ab67616d00004851cbd185b2883c3e898afe3d48","height":64,"width":64}],"name":"Off The Record","release_date":"2023-10-06","release_date_precision":"day","type":"album","uri":"spotify:album:5dIJ97uGTWrNmw6QRwMnRo","artists":[{"external_urls":{"spotify":"https://open.spotify.com/artist/6RHTUrRF63xao58xh9FXYJ"},"href":"https://api.spotify.com/v1/artists/6RHTUrRF63xao58xh9FXYJ","id":"6RHTUrRF63xao58xh9FXYJ","name":"IVE","type":"artist","uri":"spotify:artist:6RHTUrRF63xao58xh9FXYJ"}],"tracks":{"href":"https://api.spotify.com/v1/albums/5dIJ97uGTWrNmw6QRwMnRo/tracks?offset=0&limit=50","limit":50,"next":null,"offset":0,"previous":null,"total":1,"items":[{"artists":[{"external_urls":{"spotify":"https://open.spotify.com/artist/6RHTUrRF63xao58xh9FXYJ"},"href":"https://api.spotify.com/v1/artists/6RHTUrRF63xao58xh9FXYJ","id":"6RHTUrRF63xao58xh9FXYJ","name":"IVE","type":"artist","uri":"spotify:artist:6RHTUrRF63xao58xh9FXYJ"}],"available_markets":["JP"],"disc_number":1,"duration_ms":188733,"explicit":false,"external_urls":{"spotify":"https://open.spotify.com/track/0tSkMuKKrLXEfxc58cEhFX"},"href":"https://api.spotify.com/v1/tracks/3G7MgLuWLzUJQflWOCDZit","id":"3G7MgLuWLzUJQflWOCDZit","linked_from":{"external_urls":{"spotify":"https://open.spotify.com/track/0tSkMuKKrLXEfxc58cEhFX"},"href":"https://api.spotify.com/v1/tracks/0tSkMuKKrLXEfxc58cEhFX","id":null,"type":"track","uri":"spotify:track:0tSkMuKKrLXEfxc58cEhFX"},"name":"Off The Record","preview_url":"https://p.scdn.co/mp3-preview/3346ec86648d6aebb9cd5fc4693c3e534719d12a?cid=b28a574d8ad44fc7b5a89994431a8f88","track_number":1,"type":"track","uri":"spotify:track:3G7MgLuWLzUJQflWOCDZit","is_local":false}]},"copyrights":[{"text":"(P) 2023 STARSHIP ENTERTAINMENT","type":"P"}],"external_ids":{"upc":"4547366649536"},"genres":[],"label":"Sony Music Labels Inc.","popularity":45}

Observe that "id":null in the linked_from payload.

Context: I found out this issue when debugging https://github.com/aome510/spotify-player/issues/519

Originally created by @aome510 on GitHub (Aug 1, 2024). Original GitHub issue: https://github.com/ramsayleung/rspotify/issues/486 `id` field in [`TrackLink`](https://docs.rs/rspotify-model/0.13.2/rspotify_model/track/struct.TrackLink.html) can be `null`. To reproduce, call ``` curl --request GET \ --url "https://api.spotify.com/v1/albums/5dIJ97uGTWrNmw6QRwMnRo" \ --header 'Authorization: Bearer $TOKEN' ``` Expected response: ``` {"album_type":"single","total_tracks":1,"available_markets":["JP"],"external_urls":{"spotify":"https://open.spotify.com/album/5dIJ97uGTWrNmw6QRwMnRo"},"href":"https://api.spotify.com/v1/albums/5dIJ97uGTWrNmw6QRwMnRo","id":"5dIJ97uGTWrNmw6QRwMnRo","images":[{"url":"https://i.scdn.co/image/ab67616d0000b273cbd185b2883c3e898afe3d48","height":640,"width":640},{"url":"https://i.scdn.co/image/ab67616d00001e02cbd185b2883c3e898afe3d48","height":300,"width":300},{"url":"https://i.scdn.co/image/ab67616d00004851cbd185b2883c3e898afe3d48","height":64,"width":64}],"name":"Off The Record","release_date":"2023-10-06","release_date_precision":"day","type":"album","uri":"spotify:album:5dIJ97uGTWrNmw6QRwMnRo","artists":[{"external_urls":{"spotify":"https://open.spotify.com/artist/6RHTUrRF63xao58xh9FXYJ"},"href":"https://api.spotify.com/v1/artists/6RHTUrRF63xao58xh9FXYJ","id":"6RHTUrRF63xao58xh9FXYJ","name":"IVE","type":"artist","uri":"spotify:artist:6RHTUrRF63xao58xh9FXYJ"}],"tracks":{"href":"https://api.spotify.com/v1/albums/5dIJ97uGTWrNmw6QRwMnRo/tracks?offset=0&limit=50","limit":50,"next":null,"offset":0,"previous":null,"total":1,"items":[{"artists":[{"external_urls":{"spotify":"https://open.spotify.com/artist/6RHTUrRF63xao58xh9FXYJ"},"href":"https://api.spotify.com/v1/artists/6RHTUrRF63xao58xh9FXYJ","id":"6RHTUrRF63xao58xh9FXYJ","name":"IVE","type":"artist","uri":"spotify:artist:6RHTUrRF63xao58xh9FXYJ"}],"available_markets":["JP"],"disc_number":1,"duration_ms":188733,"explicit":false,"external_urls":{"spotify":"https://open.spotify.com/track/0tSkMuKKrLXEfxc58cEhFX"},"href":"https://api.spotify.com/v1/tracks/3G7MgLuWLzUJQflWOCDZit","id":"3G7MgLuWLzUJQflWOCDZit","linked_from":{"external_urls":{"spotify":"https://open.spotify.com/track/0tSkMuKKrLXEfxc58cEhFX"},"href":"https://api.spotify.com/v1/tracks/0tSkMuKKrLXEfxc58cEhFX","id":null,"type":"track","uri":"spotify:track:0tSkMuKKrLXEfxc58cEhFX"},"name":"Off The Record","preview_url":"https://p.scdn.co/mp3-preview/3346ec86648d6aebb9cd5fc4693c3e534719d12a?cid=b28a574d8ad44fc7b5a89994431a8f88","track_number":1,"type":"track","uri":"spotify:track:3G7MgLuWLzUJQflWOCDZit","is_local":false}]},"copyrights":[{"text":"(P) 2023 STARSHIP ENTERTAINMENT","type":"P"}],"external_ids":{"upc":"4547366649536"},"genres":[],"label":"Sony Music Labels Inc.","popularity":45} ``` Observe that `"id":null` in the `linked_from` payload. Context: I found out this issue when debugging https://github.com/aome510/spotify-player/issues/519
kerem 2026-02-27 20:23:28 +03:00
Author
Owner

@ramsayleung commented on GitHub (Aug 3, 2024):

I can reproduce this problem with the album id provided above, I've created a PR to fix this issue.

<!-- gh-comment-id:2267100872 --> @ramsayleung commented on GitHub (Aug 3, 2024): I can reproduce this problem with the album id provided above, I've created a PR to fix this issue.
Author
Owner

@aome510 commented on GitHub (Aug 24, 2024):

Thanks @ramsayleung!

<!-- gh-comment-id:2308531523 --> @aome510 commented on GitHub (Aug 24, 2024): Thanks @ramsayleung!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/rspotify#158
No description provided.