How to get all task added to a specific section of a project on a specific date by asana api
Hi @GP123 and welcome to the forum!
I would recommend checking out the Search API for that:
I think you should be able to use the
create_on parameters to get the tasks you want.
@Phil_Seeman : Thanks for reply.
I cannot get any result using following api request.
I think I was not clear in my requirement . Stating again : get all task added to a specific section of a project(by moving from another project ) on a specific date. So I think created_on will not fulfill requirement.
curl --header “Authorization: Bearer $ASANA_PERSONAL_ACCESS_TOKEN” “https://app.asana.com/api/1.0/workspaces//tasks/search?sections.any=&created_on.after=20200630”
First, I’ll assume you’ve just removed the
gids from your post as the syntax isn’t right but I think you just deleted the
Second, that’s not the correct date format; you’ll want something in ISO 8601 format that looks like this:
But third and most important:
Ah, that piece of info changes everything, I’m afraid. You had said “added” so I wrongly assumed you meant “added to Asana”.
I don’t know of any reliable way to get what you’re after. There’s no piece of data in the Asana data store which reliably captures the date of a task being moved from one project and/or section to another. The only thing I can suggest is to get and keep a list of the tasks in the target section(s) in your own data store someplace, then run a daily function which gets the current tasks there and compares it to what you have stored, to detect the differences and figure out what got added.
There’s a way, but it’s not easy, and also not 100% accurate.
If the tasks you need to get these informations are still in that section, first, query all ids of tasks in that section:
If you have too many tasks, I suggest to use the “search” endpoint with modified_since parameter.
Then, for each task, get their stories: (you can use the “batch” endpoint)
The opt_fields that you want are resource_subtype and created_at.
Then, loop all results, and find the most recent “resource_subtype” = “section_changed”.
But, watch out for this:
If a task was moved from another section to that section, you will see the “section_changed” event.
BUT, if the task was created directly in that section (or moved from another project?), that event does not exists.
You will need to see the most recent “added_to_project” instead.
Important note: in asana, you can “delete” items from history!!! Stories are editable and deletable. It’s possible that none of the stories are available if someone deleted them.
There’s more informations available about stories “resource_subtype” on that thread.
Hope this helps!
Well yeah… I specifically chose to omit this info and didn’t want to send him down the path of using stories, since they are potentially incomplete. In addition to your point that they can be deleted, remember also that if the same user moves tasks between sections multiple times within a 24-hour period, it’s possible that some of those stories will not exist and thus you’ll not get a complete picture, right?