Jump to content

Problem with GUIDs Trying to Add Playlist via Java API


nz987tip

Recommended Posts

nz987tip

Hello, 

Having issue trying to create a playlist via the java API.   Can connect ok and get the access token, but seems to fail on the format of the Ids.

 

 

Post parameters : [userId=319543a665084772bb4449608882bc7f, format=json, MediaType=Audio, Ids=5b4e8826-2580-3ea3-c0da-a10a8696ad87,2C85af84ce-364e-80c2-b359-c3e46ff65a67, Name=embyTest]

 

Result : {"ResponseStatus":{"ErrorCode":"FormatException","Message":"Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)."

 

Full content of POST and server response is attached.   Appreciate any help.

log4j-application_save.log

Link to comment
Share on other sites

Can you use the chrome debugger with the web client to find the difference between your http request and a working one?

Link to comment
Share on other sites

Redshirt

Out of curiosity where are the ID's coming from? Any Id's delivered though the java API have 0 dashes, just like the UserId in your example. I suspect your example would work if you just did a string replace on the dashes although that's not the ideal solution.

Link to comment
Share on other sites

nz987tip

The ID's are from the Library DB.  I have a lot of M3U files that I'd like to convert to Emby playlists.   I've tried it both ways - with the dashes in the Id's and without - same results.

 

I've included the chrome debugger (developer tools?) output below.   Strange thing is creating a playlist in the web gui results in a different error (no access token), but still creates the playlist.

 

BTW - The Emby server is on a FreeNAS 9.3 box.   Emby was installed via the FreeNAS plugin - version  3.0.5781.8

 
 

 

 

 

======================================
Action:   Create Playlist in web gui:
======================================
 
 
Emby Server Log
 
2016-01-19 01:26:18.2249 Info HttpServer: HTTP GET http://000.000.0.1:8096/emby/Playlists/e842aae6b4719748b141b692f8d561ce/Items?Fields=PrimaryImageAspectRatio%2CSyncInfo&EnableImageTypes=Primary%2CBackdrop%2CBanner%2CThumb&StartIndex=0&Limit=100&UserId=803643a6650847721111a960eeeebc7f. UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36
2016-01-19 01:26:18.2254 Error HttpAsyncTaskHandler: Error occured while Processing Request: Access token is required.
*** Error Report ***
Version: 3.0.5781.8
Command line: /usr/pbi/emby-amd64/lib/emby-server/MediaBrowser.Server.Mono.exe -ffmpeg /usr/pbi/emby-amd64/bin/ffmpeg -ffprobe /usr/pbi/emby-amd64/bin/ffprobe -programdata /var/db/emby-server
Operating system: Unix 9.1.0.0
Processor count: 4
64-Bit OS: True
64-Bit Process: True
Program data path: /var/db/emby-server
Mono: 4.0.1 (tarball Thu Sep  3 05:23:50 UTC 2015)
Application Path: /usr/pbi/emby-amd64/lib/emby-server/MediaBrowser.Server.Mono.exe
Access token is required.
MediaBrowser.Controller.Net.SecurityException
 at MediaBrowser.Server.Implementations.HttpServer.Security.AuthService.ValidateSecurityToken (IServiceRequest request, System.String token) [0x00000] in <filename unknown>:0 
 at MediaBrowser.Server.Implementations.HttpServer.Security.AuthService.ValidateUser (IServiceRequest request, IAuthenticationAttributes authAttribtues) [0x00000] in <filename unknown>:0 
 at MediaBrowser.Server.Implementations.HttpServer.Security.AuthService.Authenticate (IServiceRequest request, IAuthenticationAttributes authAttribtues) [0x00000] in <filename unknown>:0 
 at MediaBrowser.Controller.Net.AuthenticatedAttribute.RequestFilter (IRequest request, IResponse response, System.Object requestDto) [0x00000] in <filename unknown>:0 
 at ServiceStack.ServiceStackHost.ApplyRequestFiltersSingle (IRequest req, IResponse res, System.Object requestDto) [0x00000] in <filename unknown>:0 
 at ServiceStack.ServiceStackHost.ApplyRequestFilters (IRequest req, IResponse res, System.Object requestDto) [0x00000] in <filename unknown>:0 
 at ServiceStack.Host.RestHandler.ProcessRequestAsync (IRequest httpReq, IResponse httpRes, System.String operationName) [0x00000] in <filename unknown>:0 
 
2016-01-19 01:26:18.4108 Info HttpServer: HTTP GET http://000.000.0.1:8096/favicon.ico. UserAgent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.111 Safari/537.36
2016-01-19 01:26:18.4108 Error NotFoundHttpHandler: 000.000.0.1:8096 Request not found: /favicon.ico
2016-01-19 01:26:18.4110 Info HttpServer: HTTP Response 404 to 000.000.0.2. Time: 0ms. http://000.000.0.1:8096/favicon.ico
 
 
 
Chrome Developer Tools:
 
 
JSON:
{"ResponseStatus":{"ErrorCode":"SecurityException","Message":"Access token is required.","StackTrace":"  at MediaBrowser.Server.Implementations.HttpServer.Security.AuthService.ValidateSecurityToken (IServiceRequest request, System.String token) [0x00000] in <filename unknown>:0 \n  at MediaBrowser.Server.Implementations.HttpServer.Security.AuthService.ValidateUser (IServiceRequest request, IAuthenticationAttributes authAttribtues) [0x00000] in <filename unknown>:0 \n  at MediaBrowser.Server.Implementations.HttpServer.Security.AuthService.Authenticate (IServiceRequest request, IAuthenticationAttributes authAttribtues) [0x00000] in <filename unknown>:0 \n  at MediaBrowser.Controller.Net.AuthenticatedAttribute.RequestFilter (IRequest request, IResponse response, System.Object requestDto) [0x00000] in <filename unknown>:0 \n  at ServiceStack.ServiceStackHost.ApplyRequestFiltersSingle (IRequest req, IResponse res, System.Object requestDto) [0x00000] in <filename unknown>:0 \n  at ServiceStack.ServiceStackHost.ApplyRequestFilters (IRequest req, IResponse res, System.Object requestDto) [0x00000] in <filename unknown>:0 \n  at ServiceStack.Host.RestHandler.ProcessRequestAsync (IRequest httpReq, IResponse httpRes, System.String operationName) [0x00000] in <filename unknown>:0 "}}
 
 
Response Status
Error CodeSecurityExceptionMessageAccess token is required.Stack Trace at MediaBrowser.Server.Implementations.HttpServer.Security.AuthService.ValidateSecurityToken (IServiceRequest request, System.String token) [0x00000] in <filename unknown>:0 at MediaBrowser.Server.Implementations.HttpServer.Security.AuthService.ValidateUser (IServiceRequest request, IAuthenticationAttributes authAttribtues) [0x00000] in <filename unknown>:0 at MediaBrowser.Server.Implementations.HttpServer.Security.AuthService.Authenticate (IServiceRequest request, IAuthenticationAttributes authAttribtues) [0x00000] in <filename unknown>:0 at MediaBrowser.Controller.Net.AuthenticatedAttribute.RequestFilter (IRequest request, IResponse response, System.Object requestDto) [0x00000] in <filename unknown>:0 at ServiceStack.ServiceStackHost.ApplyRequestFiltersSingle (IRequest req, IResponse res, System.Object requestDto) [0x00000] in <filename unknown>:0 at ServiceStack.ServiceStackHost.ApplyRequestFilters (IRequest req, IResponse res, System.Object requestDto) [0x00000] in <filename unknown>:0 at ServiceStack.Host.RestHandler.ProcessRequestAsync (IRequest httpReq, IResponse httpRes, System.String operationName) [0x00000] in <filename unknown>:0
 
 
 
=======================================
Action:   Create Playlist via Java/API
=======================================
 
Post parameters : [userId=803643a6650847721111a960eeeebc7f, format=json, MediaType=Audio, Ids=5b4e882625803ea3c0daa10a8696ad87,2C85af84ce364e80c2b359c3e46ff65a67, Name=embyTest]
Response Code : 500
Result : {"ResponseStatus":{"ErrorCode":"FormatException","Message":"Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).","StackTrace":"[CreatePlaylist: 01/19/2016 01:34:31]:\n[REQUEST: {Name:embyTest,Ids:\"5b4e882625803ea3c0daa10a8696ad87,2C85af84ce364e80c2b359c3e46ff65a67\",UserId:803643a6650847721111a960eeeebc7f,MediaType:Audio}]\nSystem.FormatException: Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).\n  at System.Guid+GuidResult.SetFailure (ParseFailureKind failure, System.String failureMessageID, System.Object failureMessageFormatArgument, System.String failureArgumentName, System.Exception innerException) [0x00000] in <filename unknown>:0 \n  at System.Guid+GuidResult.SetFailure (ParseFailureKind failure, System.String failureMessageID) [0x00000] in <filename unknown>:0 \n  at System.Guid.TryParseGuidWithNoStyle (System.String guidString, System.GuidResult& result) [0x00000] in <filename unknown>:0 \n  at System.Guid.TryParseGuid (System.String g, GuidStyles flags, System.GuidResult& result) [0x00000] in <filename unknown>:0 \n  at System.Guid..ctor (System.String g) [0x00000] in <filename unknown>:0 \n  at MediaBrowser.Controller.Library.LibraryManagerExtensions.GetItemById (ILibraryManager manager, System.String id) [0x00000] in <filename unknown>:0 \n  at MediaBrowser.Server.Implementations.Playlists.PlaylistManager.<GetPlaylistItems>m__0 (System.String i) [0x00000] in <filename unknown>:0 \n  at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[system.String,MediaBrowser.Controller.Entities.BaseItem].MoveNext () [0x00000] in <filename unknown>:0 \n  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1E`1[MediaBrowser.Controller.Entities.BaseItem].MoveNext () [0x00000] in <filename unknown>:0 \n  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1E`1[MediaBrowser.Controller.Entities.BaseItem].MoveNext () [0x00000] in <filename unknown>:0 \n  at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator12`2[MediaBrowser.Controller.Entities.BaseItem,MediaBrowser.Controller.Entities.BaseItem].MoveNext () [0x00000] in <filename unknown>:0 \n  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1E`1[MediaBrowser.Controller.Entities.BaseItem].MoveNext () [0x00000] in <filename unknown>:0 \n  at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1E`1[MediaBrowser.Controller.Entities.BaseItem].MoveNext () [0x00000] in <filename unknown>:0 \n  at System.Collections.Generic.List`1[MediaBrowser.Controller.Entities.BaseItem]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 \n  at System.Linq.Enumerable.ToList[baseItem] (IEnumerable`1 source) [0x00000] in <filename unknown>:0 \n  at MediaBrowser.Server.Implementations.Playlists.PlaylistManager+<AddToPlaylistInternal>c__async1.MoveNext () [0x00000] in <filename unknown>:0 \n--- End of stack trace from previous location where exception was thrown ---\n  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 \n  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 \n  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 \n  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 \n  at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <filename unknown>:0 \n  at MediaBrowser.Server.Implementations.Playlists.PlaylistManager+<CreatePlaylist>c__async0.MoveNext () [0x00000] in <filename unknown>:0 \n--- End of stack trace from previous location where exception was thrown ---\n  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 \n  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 \n  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 \n  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 \n  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[MediaBrowser.Model.Playlists.PlaylistCreationResult].GetResult () [0x00000] in <filename unknown>:0 \n  at MediaBrowser.Api.PlaylistService+<Post>c__async0.MoveNext () [0x00000] in <filename unknown>:0 ","Errors":[]}}
 
 
 
Server Log:
 
2016-01-19 01:34:31.0460 Info SessionManager: Creating new access token for user 803643a6650847721111a960eeeebc7f
2016-01-19 01:34:31.0473 Info HttpServer: HTTP Response 200 to 000.000.0.2. Time: 2ms. http://000.000.0.1:8096/emby/Users/AuthenticateByName?format=json
2016-01-19 01:34:31.1576 Error DtoUtils: ServiceBase<TRequest>::Service Exception
*** Error Report ***
Version: 3.0.5781.8
Command line: /usr/pbi/emby-amd64/lib/emby-server/MediaBrowser.Server.Mono.exe -ffmpeg /usr/pbi/emby-amd64/bin/ffmpeg -ffprobe /usr/pbi/emby-amd64/bin/ffprobe -programdata /var/db/emby-server
Operating system: Unix 9.1.0.0
Processor count: 4
64-Bit OS: True
64-Bit Process: True
Program data path: /var/db/emby-server
Mono: 4.0.1 (tarball Thu Sep  3 05:23:50 UTC 2015)
Application Path: /usr/pbi/emby-amd64/lib/emby-server/MediaBrowser.Server.Mono.exe
Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
System.FormatException
 at System.Guid+GuidResult.SetFailure (ParseFailureKind failure, System.String failureMessageID, System.Object failureMessageFormatArgument, System.String failureArgumentName, System.Exception innerException) [0x00000] in <filename unknown>:0 
 at System.Guid+GuidResult.SetFailure (ParseFailureKind failure, System.String failureMessageID) [0x00000] in <filename unknown>:0 
 at System.Guid.TryParseGuidWithNoStyle (System.String guidString, System.GuidResult& result) [0x00000] in <filename unknown>:0 
 at System.Guid.TryParseGuid (System.String g, GuidStyles flags, System.GuidResult& result) [0x00000] in <filename unknown>:0 
 at System.Guid..ctor (System.String g) [0x00000] in <filename unknown>:0 
 at MediaBrowser.Controller.Library.LibraryManagerExtensions.GetItemById (ILibraryManager manager, System.String id) [0x00000] in <filename unknown>:0 
 at MediaBrowser.Server.Implementations.Playlists.PlaylistManager.<GetPlaylistItems>m__0 (System.String i) [0x00000] in <filename unknown>:0 
 at System.Linq.Enumerable+<CreateSelectIterator>c__Iterator10`2[system.String,MediaBrowser.Controller.Entities.BaseItem].MoveNext () [0x00000] in <filename unknown>:0 
 at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1E`1[MediaBrowser.Controller.Entities.BaseItem].MoveNext () [0x00000] in <filename unknown>:0 
 at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1E`1[MediaBrowser.Controller.Entities.BaseItem].MoveNext () [0x00000] in <filename unknown>:0 
 at System.Linq.Enumerable+<CreateSelectManyIterator>c__Iterator12`2[MediaBrowser.Controller.Entities.BaseItem,MediaBrowser.Controller.Entities.BaseItem].MoveNext () [0x00000] in <filename unknown>:0 
 at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1E`1[MediaBrowser.Controller.Entities.BaseItem].MoveNext () [0x00000] in <filename unknown>:0 
 at System.Linq.Enumerable+<CreateWhereIterator>c__Iterator1E`1[MediaBrowser.Controller.Entities.BaseItem].MoveNext () [0x00000] in <filename unknown>:0 
 at System.Collections.Generic.List`1[MediaBrowser.Controller.Entities.BaseItem]..ctor (IEnumerable`1 collection) [0x00000] in <filename unknown>:0 
 at System.Linq.Enumerable.ToList[baseItem] (IEnumerable`1 source) [0x00000] in <filename unknown>:0 
 at MediaBrowser.Server.Implementations.Playlists.PlaylistManager+<AddToPlaylistInternal>c__async1.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
 at System.Runtime.CompilerServices.TaskAwaiter.GetResult () [0x00000] in <filename unknown>:0 
 at MediaBrowser.Server.Implementations.Playlists.PlaylistManager+<CreatePlaylist>c__async0.MoveNext () [0x00000] in <filename unknown>:0 
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0 
 at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
 at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00000] in <filename unknown>:0 
 at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[MediaBrowser.Model.Playlists.PlaylistCreationResult].GetResult () [0x00000] in <filename unknown>:0 
 at MediaBrowser.Api.PlaylistService+<Post>c__async0.MoveNext () [0x00000] in <filename unknown>:0 
 
2016-01-19 01:34:31.1576 Error HttpServer: Error processing request for /emby/Playlists/?UserId=803643a6650847721111a960eeeebc7f&MediaType=Audio&Ids=5b4e882625803ea3c0daa10a8696ad87%2C85af84ce364e80c2b359c3e46ff65a67&Name=embyTest&format=json
*** Error Report ***
Version: 3.0.5781.8
Command line: /usr/pbi/emby-amd64/lib/emby-server/MediaBrowser.Server.Mono.exe -ffmpeg /usr/pbi/emby-amd64/bin/ffmpeg -ffprobe /usr/pbi/emby-amd64/bin/ffprobe -programdata /var/db/emby-server
Operating system: Unix 9.1.0.0
Processor count: 4
64-Bit OS: True
64-Bit Process: True
Program data path: /var/db/emby-server
Mono: 4.0.1 (tarball Thu Sep  3 05:23:50 UTC 2015)
Application Path: /usr/pbi/emby-amd64/lib/emby-server/MediaBrowser.Server.Mono.exe
Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).
ServiceStack.HttpError
No Stack Trace Available
 
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...