API to add a TAG to a Shot?

Hi,

I’m trying to add a tag to a shot and I can’t find how to do it…

A bit of context:
we are working on a python script which use the Blackmagic Resolve API to get a list of markers from a timeline. Each marker contains a note and is associated with a shot name.
I need to merge those notes as Tags in the corresponding Shotgrid Shot.
Right now I can fetch the Markers from Resolve and fetch the Shot Tags from SG but I cannot find how to ADD a tag to a shot…

Any ideas ?

Solved !

I was a bit confused at first because Tag does not show in Site Preferences.
But using Shotgun.schema_entity_read() and Shotgun.schema_field('Tag') it looks like Tag is just like any other entity.

So adding a tag to a shot is something like:

data = {"tags":[{"type": "Tag", "id": tag_id['id']}]}
Shotgun.update('Shot', self.shot_id['id'], data, multi_entity_update_modes={"tags": "add"})
1 Like