vitek

Members
  • Content count

    6
  • Joined

  • Last visited

  1. Hello, I am trying to use dedicated API key, however I'd like to make publish look like it was done by a specific user. What's the best way of doing so? Thanks in advance! Cheers. Vit
  2. Slack User Group

    Hi Lucas, could I get the invite as well? Cheers, vit.sedlacek@dazzlepictures.net
  3. can't add the note

    Works now! Thanks Remus! Cheers
  4. can't add the note

    Hi there! I'm trying to add the note with API, but can't quite nail it - I'm basically taking code from the documentation and just replacing queries with my own .... , any ideas what I am doing wrong, please? Any advice appreciated! Cheers! Here is the code: category = session.query( 'NoteCategory where name is "External Note"' ).first() note = session.create('Note', { 'content': 'New note with external category', 'author': session.query('User where username is "vit.sedlacek@dazzlepictures.net"').one(), 'category': session.query('NoteCategory where name is "Internal"').one() }) task['notes'].append(note) session.commit() And the error # Result: ERROR 18:16:46.713:ftrack_api.session.Session(7088): Server reported error: ValueError(Cannot set relationship to string value.) Traceback (most recent call last): File "<string>", line 12, in <module> File "C:/Python27/Lib/site-packages\ftrack_api\session.py", line 1238, in commit result = self._call(batch) File "C:/Python27/Lib/site-packages\ftrack_api\session.py", line 1616, in _call raise ftrack_api.exception.ServerError(error_message) ftrack_api.exception.ServerError: Server reported error: ValueError(Cannot set relationship to string value.) based on code from API documentation here (http://ftrack-python-api.rtd.ftrack.com/en/stable/example/note.html?highlight=create_note): category = session.query( 'NoteCategory where name is "External Note"' ).first() note = session.create('Note', { 'content': 'New note with external category', 'author': user, 'category': category }) task['notes'].append(note)
  5. Solved -- typo in the code
  6. Hello folks, I'm trying to write a snippet to publish a file and link it to specific task and can't get it to work - is the TypedContextLink right way to do it? I've been doing quite some trial and error and getting error messages I don't quite understand ... could you point me in the right direction, please? Cheers!! import os import ftrack_api import ftrack_api.symbol #INIT SESSION session = ftrack_api.Session( server_url=server_url, api_key=api_key, api_user=api_user ) file_path = 'C:/Users/vit.sedlacek/test.mov' asset_name = "aaaW" asset_type = session.query( 'AssetType where name is "Upload"' ).one() ##------------------------------------------------------ ##musim dostat task a pak task ID project = session.query('Project where name is _PIPELINE').one() sqs = session.query('Task where project.id is "{0}"'.format(project['id'])) #sqs.first()['name'] taskID = sqs.first()['id'] task = session.get('Task', taskID) shot = task['parent'] shot2 = session.get( 'Shot', shot['id'] ) asset = session.create('Asset', { 'name': asset_name, 'type': asset_type, 'parent': shot }) asset_version = session.create('AssetVersion', { 'asset':asset, 'task': shot, 'version': 110 }) session.create('TypedContextLink', { 'from': asset_version, 'to': task }) component = asset_version.create_component( path=file_path, data={ 'name': asset_name }, location=session.get('Location', ftrack_api.symbol.SERVER_LOCATION_ID) ) asset_version.encode_media( component ) session.commit()