Jump to content

Understanding Developer API


HemTark

Recommended Posts

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.

  1. 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.
  2. 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?
  3. 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.

Link to comment
Share on other sites

adminExitium
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).

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

adminExitium

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 by HemTark
Link to comment
Share on other sites

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.

  • Thanks 1
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

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...