Jump to content

Emby ApiClient UpdateItem


rhodges

Recommended Posts

rhodges

I'm running a GetItemsAsync and pulling back movies. I'm then iterating the items and on some I'm setting the DateCreated and calling UpdateItem, but I'm getting "The method or operation is not implemented".

 

Am I doing something wrong with how I'm updating them, or is setting the DateCreated not supported? I'm trying to update the DateAdded (which I was thinking is the same as DateCreated, but maybe not).

Link to comment
Share on other sites

  • 9 months later...
Sludge Vohaul

Though the post is quite old, you're getting the "not implemented" error, because the .Net ApiClient.UpdateItem() method's body raises only a NotImplementedException, because, well the update item functionality is not implemented.

 

I am at a similar point, see here.

 

You cannot update a single field of an item, you have to post the whole item with the field you want to change updated. Basically you have to do what the Javascript code does. See function onSubmit() and submitUpdatedItem() here and updateItem()here.

 

You'll have to pack the item's properties (BaseItemDto args = await client.GetItemAsync(itemId, userid)maybe there is a more suitable type) into a Dictionary<string, string> with key being the property's name and the value being the properties value. 

 

This is fine for string values (e.g. "ForcedSortName"), ugly for simple enumerables (e.g. "Keywords") and even uglier for complex enumerables (e.g. "Studios"). I have no idea yet how the dictionary's values should look like for the enumerable values (nor how to generate the dictionary for them from BaseItemDto).

 

It might be an idea to bypass the apiclient's public PostAsync() method, serialise the item to JSON and post the whole thing via apiclient.HttpClient - which would be the same the javascript code does.

 

HTH,

sv

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