• Content Count

  • Joined

  • Last visited

  1. strbpy

    Timelog via API

    Hi Mattias, You nailed it. 'context_id' does make a difference, it works ! Thank you so much !
  2. strbpy

    Timelog via API

    Hi, I'm trying to write in "Timelog" to FTRACK via new API. Currently my code writes the timelog but it lacks proper relationship between TASK and PROJECT which I see in case of general timelog tracked byUI. ( I attached result of this code as a screenshot ) What could be a genuine way to build a relationship between TASK and PROJECT ? Thanks in advance. # --------------------------------------------------------- session = ftrack_api.Session( server_url = 'omitted', api_key = 'omitted', api_user = 'omitted' ) # Retrieve a task : task = session.query('Task where name is "{0}"'.format("Meeting")).first() # User must be assigned to the task in order to log time: user = session.query('User where username is "{0}"'.format("omitted"))[0] # This is proper way to build connection between user and task. appointment = session.create('Appointment', { 'context': task, 'resource': user, 'type': 'assignment' }) # Log minute to a task start ='utc') duration = 60 # 1 min timelog = session.create('Timelog', { 'user_id': user['id'], 'start': start, 'duration': duration, 'contextId': task['id'] }) # commit changes session.commit() # ---------------------------------------------------------
  3. Hi Mattias, Thank you the link. I'll look into it. Cheers !
  4. Thank you Remus for the suggestion. I'm grateful. Thank you Mattias for the guide ! Have a nice day !
  5. Hi Remus, Thank you for the reply. I tried with your suggestion. And I've got this error: session.assign_user(user= user, context= task) AttributeError: 'Session' object has no attribute 'assign_user' I looked into "\site-packages\ftrack_api\" , couldn't find "assign_user" method. I made sure session is working properly by querying some tasks and projects. So it is genuine session object. Any idea ?
  6. Hi ! I'm trying to assign user for a task with new API. I've found a tutorial from legacy API : currentUser = ftrack.User(getpass.getuser()) task.assignUser(currentUser) Can someone englighten me how to achieve this with new API ? Thanks in advance