HemTark 1 Posted November 4, 2022 Posted November 4, 2022 I am new to Emby Developer API. While going through the Developer API Wiki on GitHub I got following doubts. Please help me in understanding these topics. The API key authentication is not linked to a specific user. So when using API key authentication how can I browse the whole library of the Emby server as all the APIs related to browsing library requires a user id? I can get list of all users on the server using /Users API. But then how to decide which user id to use for browsing library? This is crucial as every user might not have access to every type of media. How to connect to server as a client and create a session? As my application is sending API requests to Emby server, as per the terminology my application becomes a client. But how can I create a session for my application so that other clients know about it? What is Emby Server DLNA client? When I fetch sessions controllable by a specific user I get two sessions. First is of my browser from which I am accessing Emby server hosted in my machine. And second one is Emby Server DLNA Client. I would like to know what is this second session for? I have Emby server hosted in my local machine and I am using API key authentication for making API requests. Thanks for help in advance.
adminExitium 249 Posted November 4, 2022 Posted November 4, 2022 1 hour ago, HemTark said: The API key authentication is not linked to a specific user. So when using API key authentication how can I browse the whole library of the Emby server as all the APIs related to browsing library requires a user id? I can get list of all users on the server using /Users API. But then how to decide which user id to use for browsing library? This is crucial as every user might not have access to every type of media. Perhaps it would be better if you specify exactly what you want to achieve. In general, you can list the available libraries via Library/SelectableMediaFolders & Library/VirtualFolders and then use their IDs as the ParentId for the Items API to get the Items present in those libraries. 1 hour ago, HemTark said: But how can I create a session for my application so that other clients know about it? If you are familiar with python, you can take a look at Emby4Kodi (https://github.com/MediaBrowser/plugin.video.emby/tree/7.9.4) & EmbyCon (https://github.com/faush01/plugin.video.embycon).
HemTark 1 Posted November 4, 2022 Author Posted November 4, 2022 15 minutes ago, adminExitium said: Perhaps it would be better if you specify exactly what you want to achieve. In general, you can list the available libraries via Library/SelectableMediaFolders & Library/VirtualFolders and then use their IDs as the ParentId for the Items API to get the Items present in those libraries. I would like to retrieve all the items in the Emby server. As I explored /Users/{UserId}/Items API I thought I always need to send user id to get the items. The solution mentioned by you is exactly what I wanted.
HemTark 1 Posted November 4, 2022 Author Posted November 4, 2022 21 minutes ago, adminExitium said: If you are familiar with python, you can take a look at Emby4Kodi (https://github.com/MediaBrowser/plugin.video.emby/tree/7.9.4) & EmbyCon (https://github.com/faush01/plugin.video.embycon). Is there a wiki reference related to creating a session as I am trying to achieve this in .NET?
adminExitium 249 Posted November 4, 2022 Posted November 4, 2022 I am not aware of any .NET client off-hand but perhaps these will be helpful: https://github.com/MediaBrowser/Emby/wiki/User-Authentication#authenticating-a-user https://github.com/MediaBrowser/Emby/wiki/Browsing-the-Library https://github.com/MediaBrowser/Emby/wiki/Web-Socket https://github.com/MediaBrowser/Emby/wiki/Video-Streaming https://github.com/MediaBrowser/Emby/wiki/Playback-Check-ins https://github.com/MediaBrowser/Emby/wiki/Remote-control
HemTark 1 Posted November 4, 2022 Author Posted November 4, 2022 (edited) I had look at these wiki references. But I am still not able to find answer to question How can I create a session for my application so that other clients know about it? I don't want to use .NET Client library. Rather I want to create my own .NET Client using the APIs. In the Remote Control section of wiki there is mention of work session but no mention of how to create and manage it. The /Sessions APIs just provide access to existing sessions and sending command to them. I would like to have more information on creating and managing sessions using APIs. Edited November 4, 2022 by HemTark
adminExitium 249 Posted November 4, 2022 Posted November 4, 2022 https://github.com/MediaBrowser/Emby/wiki/Playback-Check-ins#playback-started
Luke 38553 Posted November 4, 2022 Posted November 4, 2022 2 hours ago, HemTark said: I had look at these wiki references. But I am still not able to find answer to question How can I create a session for my application so that other clients know about it? I don't want to use .NET Client library. Rather I want to create my own .NET Client using the APIs. In the Remote Control section of wiki there is mention of work session but no mention of how to create and manage it. The /Sessions APIs just provide access to existing sessions and sending command to them. I would like to have more information on creating and managing sessions using APIs. Authentication, reporting capabilities, opening a web socket, and then playback check-ins are the key. 1
HemTark 1 Posted November 9, 2022 Author Posted November 9, 2022 I discovered that when we are using API Key authentication and we send any request (which requires authentication) with the API Key in header, the server will create a new session for it where client is the app name we used while creating the API Key. To remove that session we can send a request to /Sessions/Logout API with the API Key in header.
HemTark 1 Posted November 9, 2022 Author Posted November 9, 2022 Also a call to the /Session/Logout API with API Key in header deletes the API Key from configuration. @Luke Is there a way to remove session without deleting the API Key.
Luke 38553 Posted November 9, 2022 Posted November 9, 2022 11 hours ago, HemTark said: Also a call to the /Session/Logout API with API Key in header deletes the API Key from configuration. @Luke Is there a way to remove session without deleting the API Key. There isn't no. Why do you want to do t hat?
HemTark 1 Posted November 16, 2022 Author Posted November 16, 2022 If I use the API Key authentication in my app it will create a session for that API Key. Now if my application disconnects (or is off), there is no way for other clients to determine that the session is not active and will not be able to accept commands. That's why I want to remove the session without actually deleting the API Key.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now