Search code examples
deezer

Set a playlist picture using the Deezer JS API


My client would like to create playlists on Deezer, and also add their own pictures against their creations. I have a simple playlist creation call, using the Deezer JS SDK:

playlistObj = // already created object with title, 
              // description, images array and 
              // array of Deezer track IDs
DZ.api('user/me/playlists', 'POST',
    // fields object
    {
        title : playlistObj.name,
        picture_small: playlistObj.images[2].url,
        picture_medium: playlistObj.images[1].url,
        picture_big: playlistObj.images[0].url,
    }, 
    function (response) {
        DZ.api('playlist/'+response.id+'/tracks', 'POST', 
            { songs: playlistObj.tracks },
            function (playlistTracksResponse) {
                console.log(playlistTracksResponse); // true
            }
        );
    }
);

The playlist and tracks create fine and I can see them on my account. However, the picture urls I'm setting and passing in the fields object and not being used by Deezer. Do the images need to be in a specific format? Do they need to be in a specific size? Can you only set images with a specific account type?

The documentation doesn't suggest that picture uploading is precluded, and I've tried various combinations of images from google image searches, of jpg, png and of a variety of sizes, including 200x200px as I can see on their site.

Any help?


Solution

  • I'm sorry, what you're trying to do isn't supported by the API. When you create a playlist, the only field you can set is title.