I've been working on an app that allows Spotify playlist creation via their web api. I want to make a public playlist, however it seems to alternate between making public and private playlists.
I make two requests - one to create the playlist, and another to populate it with tracks. The scopes I am using are 'playlist-modify-public' and 'playlist-modify-private' (I added the latter as it would error trying to populate on the occasions when a private playlist was created).
I am passing in the public:true argument on playlist creation, and the success result returned from Spotify always confirms that the playlist has been made public. However visiting the Spotify app shows that it is only made public about a third of the time.
My playlist creation call looks something like this: https://api.spotify.com/v1/users/[username]/playlists
with post data {"public":true,"name":"Test playlist"}
This returns a 201 result with playlist created an id and public set to true. (However it isn't when visiting it in Spotify).
My second call to populate the playlist looks like this: https://api.spotify.com/v1/users/[username]/playlists/[playlistid from above result]/tracks
with post data ["spotify:track:6eYYm2xwrvdav2yakF3cqg","spotify:track:21N8iHmlc4Xv6mCN6Yi9p6","spotify:track:59LwZvfjcbHs90huzN7j1r"]
This populates the playlist with the tracks and returns as 201.
My full list of scopes looks like this (our app does other thinsg apart from playlist creation):
user-read-private user-read-email playlist-modify-public playlist-modify-private playlist-read-private user-library-read
I thought perhaps the second call was setting it to private but it seems to be happening in the first step despite the result saying otherwise.
Is there anything I'm doing wrong? Has anyone else had this issue? Currently our solution is to do a third PUT request to set the playlist back to public, and this seems to stick. Thoughts?