Jellyfin Forum
Does Items not exist? - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Development (https://forum.jellyfin.org/f-development)
+--- Forum: Client Development (https://forum.jellyfin.org/f-client-development)
+--- Thread: Does Items not exist? (/t-does-items-not-exist)



Does Items not exist? - Kenneth Armstrong - 2023-08-14

Hi all.
I'm tinkering around with a Python client and so far I can log it in, and out, and get a list of users and system info. However, when I try to perform a GET on this endpoint, /Items, it does not seem to work. I'm following the example here:

https://api.jellyfin.org/#tag/Items/operation/GetItems

It's possible that I am doing something wrong (at the moment just trying to do a json dumps at that endpoint) but I just wanted to make sure that this particular endpoint is the correct one to use to parse a library.

Thanks.


RE: Does Items not exist? - niels - 2023-08-14

Without any logs we can only guess, is the response invalid? Does the server throw an exception? Please give us some more detail.


RE: Does Items not exist? - Kenneth Armstrong - 2023-08-14

(2023-08-14, 12:53 PM)niels Wrote: Without any logs we can only guess, is the response invalid? Does the server throw an exception? Please give us some more detail.

Yep, my bad. I'm getting an HTTP 400, so my request is wrong.

Code:
[2023-08-14 09:57:05.122 -04:00] [INF] [67] Jellyfin.Server.Implementations.Users.UserManager: Authentication request for "Kenny" has succeeded.
[2023-08-14 09:57:05.122 -04:00] [INF] [67] Emby.Server.Implementations.Session.SessionManager: Current/Max sessions for user "Kenny": 3/0
[2023-08-14 09:57:05.124 -04:00] [INF] [67] Emby.Server.Implementations.Session.SessionManager: Creating new access token for user blahblahblahblah
[2023-08-14 09:57:05.361 -04:00] [ERR] [67] Jellyfin.Server.Middleware.ExceptionMiddleware: Error processing request. URL "GET" "/Items".
System.ArgumentNullException: Value cannot be null. (Parameter 'user')

I'm still tinkering with this (learning as I go) so I'm sure I'll get it figured out.


RE: Does Items not exist? - niels - 2023-08-14

Make sure to set the user id query parameter


RE: Does Items not exist? - Kenneth Armstrong - 2023-08-14

(2023-08-14, 04:00 PM)niels Wrote: Make sure to set the user id query parameter

That's the part that I'm messing up right now:

Code:
parameters = {
'user': user_id
}
print(parameters)

all = requests.get(f'{server_url}/Items', params=parameters, headers=auth_headers)

For some reason, the logs keep saying that 'user' is null, so I still don't have the header right I think.


RE: Does Items not exist? - niels - 2023-08-14

The parameter is called "userId" as listed on api.jellyfin.org. The exception in the logs is because it cannot find a user because the id is missing.


RE: Does Items not exist? - Kenneth Armstrong - 2023-08-14

(2023-08-14, 04:42 PM)niels Wrote: The parameter is called "userId" as listed on api.jellyfin.org. The exception in the logs is because it cannot find a user because the id is missing.

Son of a gun, that's what it was. I saw 'user' in the log and kept trying to pass that. I changed it to 'userid' and it worked. Thanks!