Search code examples
deezer

deezer android sdk, add tracks to playlists


Is it possible to add tracks to playlists with the Deezer Android SDK?

When creating the DeezerRequest, there doesn't seem to be any way to set the method to 'POST' instead of 'GET'.


Solution

  • The DeezerRequest object has three constructor methods, illustrated below :

    // Creates a GET request with the given path
    DeezerRequest request = new DeezerRequest("artist/27");
    
    // Creates a GET request with the given path and query parameters
    Bundle params = new Bundle(1);
    params.putString("q", "Daft Punk"); 
    DeezerRequest request = new DeezerRequest("search/artist", params);
    
    // Creates a POST request with the given path and parameters
    Bundle params = new Bundle(1); 
    params.putString("songs", "1234567,4567891,7891234");
    DeezerRequest request = new DeezerRequest("search/artist", params, "POST");