Jump to content

Unable to add items to playlists via API (4.8.0.69)


ellisd4
Go to solution Solved by Luke,

Recommended Posts

ellisd4

This might be the wrong place, but I have a script written post Playlist API changes in 4.8.x.  This script worked until I upgraded from beta 4.8.0.66 to 4.8.0.69.  Testing via REST client I am getting the following:

Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.

Has anything in the API changed for playlists between these versions?

API call being used for testing:

{{baseUrl}}/Playlists/:Id/Items?Ids=2862576

API Key is OK as it works for other API calls and Playlist ID is fine as a query to get all items from the playlist is successful. 

Link to comment
Share on other sites

Hi there, please attach the complete emby server log. Thanks.

Link to comment
Share on other sites

OK there's no user here. that's required now to verify access to editing the playlist. How have you authenticated?

Link to comment
Share on other sites

ellisd4

Via API key.  It has worked without a user up until 4.8.0.66.  It was written post playlist changes (since the SmartPlaylist Plugin doesn't work).  Is a User now required for Playlist updates?

Screenshot 2024-01-15 at 2.37.14 PM.png

Link to comment
Share on other sites

OK, currently api keys are not associated with any user. That will likely eventually change, but until then, you'll need to supply a user id, representing the user who is making the playlist change.

Link to comment
Share on other sites

ellisd4
6 minutes ago, Luke said:

OK, currently api keys are not associated with any user. That will likely eventually change, but until then, you'll need to supply a user id, representing the user who is making the playlist change.

Ah! Thank you!  I went ahead and changed that and it works for the add, but not the delete.  I don't see that as a parameter field in the existing API docs?

 

 

Screenshot 2024-01-15 at 3.19.13 PM.png

Link to comment
Share on other sites

ellisd4

@LukeThis is the log entry from the delete attempt.  I tried with UserID as well as POST and DELETE and it was not successful. 

2024-01-16 14:08:12.201 Debug Server: http/1.1 Response 200 to 127.0.0.1. Time: 0ms. GET http://127.0.0.1:8096/emby/Sessions?api_key=x_secret10_x
2024-01-16 14:08:13.543 Info Server: http/1.1 DELETE http://host4/emby/Playlists/2847381/Items?EntryIds=2862576&api_key=x_secret15_x. UserAgent: PostmanRuntime/7.35.0
2024-01-16 14:08:13.543 Debug SqliteItemRepository: GetitemById Playlist 2847381 C:\Program Files\Emby\programdata\data\playlists\Recently Added Music [playlist]\Recently Added Music.m3u
2024-01-16 14:08:13.543 Info App: Sqlite: 1 - near "from": syntax error in "select  from MediaItems A where A.Id=2847381 LIMIT 1"
2024-01-16 14:08:13.544 Error Server: Error processing request
	*** Error Report ***
	Version: 4.8.0.69
	Command line: C:\Program Files\Emby\system\EmbyServer.dll C:\Program Files\Emby\system\EmbyServer.dll -noautorunwebapp
	Operating system: Microsoft Windows 10.0.22635
	Framework: .NET 6.0.25
	OS/Process: x64/x64
	Runtime: C:/Program Files/Emby/system/System.Private.CoreLib.dll
	Processor count: 24
	Data path: C:\Program Files\Emby\programdata
	Application path: C:\Program Files\Emby\system
	SQLitePCL.pretty.SQLiteException: Error: near "from": syntax error - select  from MediaItems A where A.Id=2847381 LIMIT 1
	SQLitePCL.pretty.SQLiteException: Exception of type 'SQLitePCL.pretty.SQLiteException' was thrown.
	   at SQLitePCL.pretty.SQLiteDatabaseConnection.PrepareStatement(String sql, ReadOnlySpan`1& tail)
	   at SQLitePCL.pretty.DatabaseConnection.PrepareStatement(IDatabaseConnection This, String sql)
	   at Emby.Server.Implementations.Data.SqliteItemRepository.QueryItemsInTransaction[T](InternalItemsQuery query, IDatabaseConnection db, String[] columnsToSelect, Boolean filterColumns, String[] groupBy, Func`5 rowReaderFn, String methodName)
	   at Emby.Server.Implementations.Data.SqliteItemRepository.GetShareLevels(InternalItemsQuery query)
	   at MediaBrowser.Controller.Entities.BaseItem.GetShareLevel(User user)
	   at MediaBrowser.Controller.Entities.BaseItem.AssertHasMinimumShareLevel(User user, UserItemShareLevel shareLevel)
	   at Emby.Api.PlaylistService.Any(RemoveFromPlaylist request)
	   at Emby.Server.Implementations.Services.ServiceController.Execute(HttpListenerHost appHost, Object requestDto, IRequest req, Type serviceType)
	   at Emby.Server.Implementations.Services.ServiceHandler.ProcessRequestAsync(HttpListenerHost httpHost, IServerApplicationHost appHost, IRequest httpReq, IResponse httpRes, IStreamHelper streamHelper, RestPath restPath, String responseContentType, CancellationToken cancellationToken)
	   at Emby.Server.Implementations.HttpServer.HttpListenerHost.RequestHandler(IRequest httpReq, ReadOnlyMemory`1 urlString, ReadOnlyMemory`1 localPath, CancellationToken cancellationToken)
	Source: SQLitePCL.pretty
	TargetSite: SQLitePCL.pretty.IStatement PrepareStatement(System.String, System.ReadOnlySpan`1[System.Byte] ByRef)
	
2024-01-16 14:08:13.544 Info Server: http/1.1 Response 500 to host5. Time: 1ms. DELETE http://host4/emby/Playlists/2847381/Items?EntryIds=2862576&api_key=x_secret15_x

Thanks!

Edited by ellisd4
Link to comment
Share on other sites

  • Solution

OK scratch that. Ignore what I've said and just go back to what you've been doing. These errors should be gone in the next build.

  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...