Hi guys. I'm trying to link some artists to project, so i do this:
# Get all linked users
sg_projectUsers = sg.find_one('Project', filters = [['id', 'is', 152]], fields=['users'])['users']
pprint(sg_projectUsers)
#Result:
[{'id': 161, 'name': 'Alexey #####', 'type': 'User'},
{'id': 174, 'name': 'Dmitry ####', 'type': 'User'},
{'id': 138, 'name': 'Maxim #####', 'type': 'User'}]
The question is - what is 'User" type?? This type is inappropriate for updating project:
data = dict(users = sg_projectUsers)
sg.update('Project', 152, data)
# This causing errors
shotgun_api3.shotgun.Fault: API update() invalid/missing entity hash string 'type':
{"name"=>"Alexey #####", "type"=>"User", "id"=>161}
So i have to change type to 'HumanUser' before calling update:
for u in sg_projectUsers:
u['type'] = 'HumanUser'
After that, all works fine. So tell me please, is it ok doing this? Or there is beter solution? Thx!