Skip to main content
The DeezerApiService is a Retrofit interface that provides access to the Deezer public API for searching and retrieving music metadata.
This service uses the public Deezer API (api.deezer.com) and does not require authentication for basic operations like search and metadata retrieval.
Source Location: app/src/main/java/com/crowstar/deeztrackermobile/features/deezer/DeezerApiService.kt

Search Methods

searchTracks()

Search for tracks by query string.
query
String
required
Search query string
index
Int?
default:"null"
Pagination offset (default: 0)
limit
Int?
default:"null"
Number of results to return (default: 25)
return
TrackSearchResponse
Search response containing list of tracks and pagination info
Example:
val apiService: DeezerApiService = // ... Retrofit instance
val results = apiService.searchTracks(
    query = "Queen Bohemian Rhapsody",
    index = 0,
    limit = 25
)

searchAlbums()

Search for albums by query string.
query
String
required
Search query string
index
Int?
default:"null"
Pagination offset
limit
Int?
default:"null"
Number of results to return
return
AlbumSearchResponse
Search response containing list of albums

searchArtists()

Search for artists by query string.
query
String
required
Search query string
index
Int?
default:"null"
Pagination offset
limit
Int?
default:"null"
Number of results to return
return
ArtistSearchResponse
Search response containing list of artists

searchPlaylists()

Search for playlists by query string.
query
String
required
Search query string
index
Int?
default:"null"
Pagination offset
limit
Int?
default:"null"
Number of results to return
return
PlaylistSearchResponse
Search response containing list of playlists

Artist Methods

getArtist()

Get detailed information about a specific artist.
id
Long
required
Deezer artist ID
return
Artist
Artist details including name, picture, and fan count
Example:
val artist = apiService.getArtist(id = 27L) // Queen

getArtistAlbums()

Get albums by a specific artist.
id
Long
required
Deezer artist ID
index
Int?
default:"null"
Pagination offset
limit
Int?
default:"null"
Number of results to return
return
AlbumSearchResponse
List of albums by the artist

getArtistTopTracks()

Get the top tracks for an artist.
id
Long
required
Deezer artist ID
limit
Int?
default:"10"
Number of top tracks to return
return
TrackListResponse
List of the artist’s most popular tracks

Album Methods

getAlbum()

Get detailed information about a specific album.
id
Long
required
Deezer album ID
return
Album
Album details including title, artist, release date, and cover art
Example:
val album = apiService.getAlbum(id = 302127L) // A Night at the Opera

getAlbumTracks()

Get all tracks in an album.
id
Long
required
Deezer album ID
index
Int?
default:"null"
Pagination offset
limit
Int?
default:"null"
Number of results to return
return
TrackListResponse
List of tracks in the album

Playlist Methods

getPlaylist()

Get detailed information about a specific playlist.
id
Long
required
Deezer playlist ID
return
Playlist
Playlist details including title, creator, and track count

getPlaylistTracks()

Get all tracks in a playlist.
id
Long
required
Deezer playlist ID
index
Int?
default:"null"
Pagination offset
limit
Int?
default:"null"
Number of results to return
return
TrackListResponse
List of tracks in the playlist

Pagination Methods

For advanced use cases, the service provides URL-based pagination methods:
  • searchTracksByUrl(@Url url: String) - Load next/previous page of track search results
  • searchAlbumsByUrl(@Url url: String) - Load next/previous page of album search results
  • searchArtistsByUrl(@Url url: String) - Load next/previous page of artist search results
  • searchPlaylistsByUrl(@Url url: String) - Load next/previous page of playlist search results
  • getAlbumTracksByUrl(@Url url: String) - Load next/previous page of album tracks
  • getArtistAlbumsByUrl(@Url url: String) - Load next/previous page of artist albums
  • getPlaylistTracksByUrl(@Url url: String) - Load next/previous page of playlist tracks
These methods accept the next URL from pagination responses.

Implementation

The service is typically accessed through DeezerRepository, which provides:
features/deezer/DeezerRepository.kt
class DeezerRepository {
    private val apiService: DeezerApiService = RetrofitClient.deezerApiService
    
    suspend fun searchTracks(query: String, index: Int = 0): TrackSearchResponse {
        return apiService.searchTracks(query, index, 25)
    }
    
    // ... other methods
}

Response Types

All search responses include pagination information:
data
List<T>
List of results (tracks, albums, artists, or playlists)
total
Int
Total number of results available
next
String?
URL for the next page of results (null if last page)
prev
String?
URL for the previous page of results (null if first page)

See Also

Data Models

Track, Album, and Playlist data structures

Search & Discovery

How search is implemented in the app

Build docs developers (and LLMs) love