Jump to content

Recommended Posts

psubsee2002
Posted

I started experimenting with the API to see if it is more reliable than relying on the XML files, using the API Client on Github (https://github.com/MediaBrowser/Emby.ApiClient)

 

One of the items I need most is the external metadata provider id's and I'm wondering how to get them.  I've start with the example posted on the Github page to get all of the items in a user's library 

var items = await client.GetItemsAsync(new ItemQuery
{
    UserId = client.UserId,
    Recursive = true
});

If I look at the definition of BaseItemsDto, there is a property called ProviderIds.  That looks like it could be the information I am looking for, but when I run the above query, it is null for every item.  The data does exist in the Metadata Manager, so wouldn't appear to be an issue with the Metadata itself.

 

Am I looking in the wrong spot?  Or is there something else I need to do to get the external ids?  I looked at the members of ItemQuery and I don't see anything that jumps out at me as a property that will trigger the inclusion of the these ids (assuming that it is available there at all).

psubsee2002
Posted (edited)

Ok, I overlooked one property.  The ItemQuery.Fields enum has a value for ProviderIds which solved my problem.  Once that option was added, I was able to see the external metadata provider ids.

Edited by psubsee2002
  • Like 1
Posted

There are a lot of potential fields to retrieve so many of them are optional so that we don't send huge amounts of data for each item when it isn't needed.

 

Also, I know you are just testing, but your query above will not be practical in any real situation (trying to retrieve the entire library in one shot).  There are paging parameters as well as type-specific parameters and lots of other query-narrowing possibilities.

psubsee2002
Posted

Also, I know you are just testing, but your query above will not be practical in any real situation (trying to retrieve the entire library in one shot).  There are paging parameters as well as type-specific parameters and lots of other query-narrowing possibilities.

 

As you mentioned, I'm mostly just using it for testing purposes to get familiar with the API.  Most of the code is way over my head so my strategy has been to keep adding to the query I have until I understand what I can get and how.  

 

But thanks, I have a feeling I will have a few more questions before my testing is complete.

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