We use another tool to track our dev teams’ hours, which can generate output and log that time back to Asana. But the API forces the actual time to be logged to the person with PAT, which sets the created by. Instead, if you have the correct permissions on the PAT (you are an approver for that user), you can override the created by in the Asana api to log the actual time as the user you are the approver for
Hi @Chiraag_Ramjee and welcome to the forum,
I moved your post to the forum section for discussion of API matters.
However, maybe it’s me but I’m not getting whether your post is a request for a change or is just letting us know how the time logging can be used in the case of wanting to log for another user?
Hi Phil, It is both a request for the change on the API and how this can be done via your API.
Hi @Chiraag_Ramjee , just to make sure I understand correctly, could you provide a bit more detail on your use case and what challenges you’re running into? It would also be helpful to know which endpoints you’re currently using and the outcomes.
In general, actions performed via the API using a PAT are attributed to the PAT owner, and the permissions are scoped to that user’s access, both of which are intended behaviors.
Hi @Mikhail_Melikhov, we have a similar issue/request here. We have an external tool that is used for time tracking and have setup an integration to push the time entries to Asana. However, all the entries are attributed to the PAT owner, whereas we would like the ability to populate other users’ timesheets.
Is it possible/can be made possible?
Hi @Dave_Speake, thanks for flagging this!
Time Tracking API always attributes time entries to the authenticated user, so this is expected. To populate timesheets for multiple users from your external tool, each user would need to authenticate the integration with their own token, ideally via OAuth rather than individual PATs.
That way, each API call runs as that specific user and entries land on the correct timesheet automatically.
The only way to log time on behalf of someone else today is through Asana’s UI (available to time reviewers for their submitters, or org admins).
Happy to pass this along as a feature request for API-based “log time on behalf of,” since the capability already exists in the product.
Hi @Mikhail_Melikhov, we came to the same conclusion and added the functionality for users to authenticate themselves, so we have a workaround for now.
The issue with logging time on behalf of someone else within Asana is that the Time Tracking Entry does not include the user the time entry is attributed to. There’s only a Created At field which is the user that created the entry as opposed to the user who’s timesheet it’s on. I can’t see anyway to work back in the API to obtain the attributable user from the time entry as there’s no reference to the user or the user’s timesheet ID in any of the Time Tracking Entry endpoints.
@Dave_Speake you’re correct, Time Tracking Entry does not surface the person whose timesheet the time belongs to.
The recommended approach to query per user entries is currently using the user filter on the list endpoint: GET /time_tracking_entries?user=<user_gid>&start_on=<date>&end_on=<date> This filter matches on the timesheet owner, so every entry returned belongs to that user’s timesheet regardless of who logged it. You can additionally scope by project, portfolio, and date range.
The current limitation is that there’s no field to resolve the owner from a single entry when it was logged by someone else, I’ll pass that along as a feature request.
Thank you. A primary use case is for webhooks. When we listen for a new time tracking entry, we need a way to attribute this within our app. Currently we just use created_at.
That’s a valid point @Dave_Speake . I’ve raised an internal task with the timesheets team to check whether this is an intentional gap, will update once I hear back!