Tilt 15 Report post Posted November 7, 2016 Hi, I've tried to follow the example in the api docs on how to add attachments to jobs. However, I'm receiving a weird error. My code: job = session.create('Job', { 'user': user, 'status': 'running', 'data': dumps({'description': 'test job'}) }) server_location = session.query('Location where name is "ftrack.server"').one() component = session.create_component( logfile, data={'name': 'My FileName'}, location=server_location ) session.create( 'JobComponent', {'component_id': component['id'], 'job_id': job['id']} ) I receive an error in create_component: LocationError: Failed to register components with location <Location("ftrack.server", 3a372bde-05bc-11e4-8908-20c9d081909b)> due to error: Server reported error: PermissionError(Permission denied: not allowed to 'update' 'User'. Missing the required 'Manage users' permission.) Transferred component data that may require cleanup: [(<dynamic ftrack FileComponent object 25089360>, 'bdad7a2b-9d64-413d-be37-4a9b3dcf7ad4')] I'm using an API key that doesn't have the "Manage Users" permission. I can grant them but I'm curious as to why this error happens and why creating the component needs user management permissions in the first place. Share this post Link to post Share on other sites
Mattias Lagergren 145 Report post Posted November 8, 2016 Hi Tilt, very odd error indeed! I've ran your code with the following tweaks and it works as expected: import ftrack_api import json session = ftrack_api.Session() user = session.query('User where username="mattias.lagergren"').first() logfile = '/path/to/a/file' job = session.create('Job', { 'user': user, 'status': 'running', 'data': json.dumps({'description': 'test job'}) }) server_location = session.query('Location where name is "ftrack.server"').one() component = session.create_component( logfile, data={'name': 'My FileName'}, location=server_location ) session.create( 'JobComponent', {'component_id': component['id'], 'job_id': job['id']} ) I've set my user ("mattias.lagergren") to not having the "Manage user" permission. Do you do anything else before creating the job? If you could attach a complete standalone example as a python file that would help a lot. Let me know the permissions of the user that runs the script as well as the "user" variable when creating the job . After some more investigations I was able to reproduce this issue! I will submit a bug report for it and see if we can have it fixed! A possible workaround is to set the user_id rather than the user on the job: job = session.create('Job', { 'user_id': user['id'], 'status': 'running', 'data': json.dumps({'description': 'test job'}) }) Share this post Link to post Share on other sites
Tilt 15 Report post Posted November 8, 2016 Thank you! Share this post Link to post Share on other sites