//user was not provided, return an error return; } $userId = intval($userId); if ($api->requesterId !== $userId) { $api->output(403, 'Playlist can be updated by its owner only'); //indicate the requester is not the playlist owner and is not allowed to update it return; } if (!$api->checkParameterExists('sequence', $sequence)) { $api->output(400, 'Track sequence must be provided'); //$sequence was not provided, return an error return; } $playlistItem = new PlaylistItem($userId, $sequence, null); if (!$playlistItem->delete()) { $api->output(404, 'No such track in playlist'); //something happened during track deletion (probably sequence was not existing), return not found error return; } $api->output(204, null); break; case 'PUT': if (!$api->checkAuth()) { //User not authentified/authorized return false; } if (!$api->checkParameterExists('userId', $userId)) { $api->output(400, 'User identifier not provided'); //user was not provided, return an error return;