Jump to content

Update item tags via REST API?


Go to solution Solved by Luke,

Recommended Posts

Posted

Ok, the quest to sync *arr tags to Emby continues.

It looks like to update tags, I will be using the ItemUpdateService, so far so good.

Within the schema, I see:

Tags	[string]

 

If I pull an item with a tag as an example, it looks like:

 

TagItems          : {@{Name=SyncTagTest; Id=1349589}}

I'm assuming these are referring to the same thing, TagItems is clearly what I want to edit, so partly verifying Tags is the correct field to update via the ItemUpdateService?

I've also got questions on the format I need to submit in:

  • Are the tags submitted by the ID? If this is the case it probably negates needing to answer most of the other questions besides how to submit multiple tags
  • if I were to add SyncTagTest to another movie, that would I set the string to in Tags?
  • Is Emby going to match the existing tag?
  • How do I submit multiple tags? Is it a comma separated list?
  • Do I need the Tag ID as well?
  • If I do need the Tag ID (I'm assuing Id=1349589 in my example is the ID of the tag itself) does that mean the tag has to be created first, separately before I can assign it?
  • If they are dynamically created, to I have to be careful with case-sensitivity? (I will be anyway, but just in case, I would like to know what happens if I mess case up somewhere)

I think that's all I've got for now. I'm just realzing I might have to actually write a whole bit to get the existing tags first if it's all done by ID.

Thanks!

 

 

Posted
Quote
  • Are the tags submitted by the ID? If this is the case it probably negates needing to answer most of the other questions besides how to submit multiple tags
  • if I were to add SyncTagTest to another movie, that would I set the string to in Tags?
  •  

Use TagItems. You don't need the tag id. Tags right now are currently case-insensitive, but I would suggest being consistent about it in case that ever changes.

Posted (edited)
4 hours ago, Luke said:

Use TagItems. You don't need the tag id. Tags right now are currently case-insensitive, but I would suggest being consistent about it in case that ever changes.

Ah, I missed TagItems is in the ItemUpdateService. So I just leave the ID blank? Swagger shows it as

[NameLongIdPair{
Name    string
Id    integer($int64)
}]

I'm working with processed output via PowerShell so I'm seeing a hash table instead of raw, but it looks like each is stored as a set of name value pairs, each containing a Name and ID...so you're saying I can just submit Name=foo or just omit ID entirely when performing an update? I'm assuming I can send multiple values this way, and that the operation replaces what is there now? Or is it additive and I do each tag one at a time?

so I guess I'm saying, would this be a valid JSON object for TagItems:

"TagItems": {
  "name": "tag1",
  "name": "tag2"
}

or are you saying I could do:

"TagItems": ["tag1", "tag2"]

Thanks!

Edited by Chiefmas
  • Solution
Posted

The latter.

Posted
10 hours ago, Chiefmas said:

Ah, I missed TagItems is in the ItemUpdateService

I just realized why I missed this earlier, I've been using the static Swagger linked from EmbyDev here; it must be and older version because TagItems isn't listed there.

I'm just using the regular API documentation now/swagger from my local server instance.

  • Thanks 1

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