SpotifyWebAPI\SpotifyWebAPI::createUserPlaylist PHP Метод

createUserPlaylist() публичный Метод

Requires a valid access token. https://developer.spotify.com/web-api/create-playlist/
public createUserPlaylist ( string $userId, array | object $options ) : array | object
$userId string ID of the user to create the playlist for.
$options array | object Options for the new playlist. - name string Required. Name of the playlist. - public bool Optional. Whether the playlist should be public or not.
Результат array | object The new playlist. Type is controlled by SpotifyWebAPI::setReturnAssoc().
    public function createUserPlaylist($userId, $options)
    {
        $options = json_encode($options);
        $headers = $this->authHeaders();
        $headers['Content-Type'] = 'application/json';
        $uri = '/v1/users/' . $userId . '/playlists';
        $this->lastResponse = $this->request->api('POST', $uri, $options, $headers);
        return $this->lastResponse['body'];
    }