Export JSON format including stories

Hello everyone,

I’m having a problem with export JSON format.

My goal is to migrate projects and tasks including all ‘comments’ from ASANA to Phabricator.
With the help of the following URL, I have succeeded without comments.

However, when I tried to export JSON including comments, I failed to access stories in ASANA.
(Above site recommends modifying the ‘opt_expand’ parameter by adding %7Cstories% in the URL)

I have read the API documentation and followed it the same way but failed.

These are what I faced: (for simplicity, I modified id and gid number)

  1. curl -H "Authorization: Bearer “my token” asana/api/1.0/projects/“projectid”/tasks
    => OK
    “data” :
    “id” : 1
    “gid” : 1
    “name” : “first”
    “resource_type”: “task”

    “id” : 2
    “gid” : 2
    “name” : “second”
    “resource_type”: “task”

  2. curl -H "Authorization: Bearer “my token” asana/api/1.0/projects/“projectid”/tasks/2
    => Failed
    “errors”: “message”: No matching route for request

  3. curl -H "Authorization: Bearer “my token” asana/api/1.0/tasks/2/stories
    => OK, I can see the comments in that task

However, 3) shows all comments for only that task. What I really want to get is the JSON file which contains everything including all tasks and comments.

Is there any way to solve this?

Best wishes.


There’s no documented way to get stories/comments while querying the tasks. Stories aren’t listed as a sub field in the data model for Tasks, and requesting opt_expand=stories doesn’t do anything.

Interestingly opt_expand=subtasks does work for now, but this is undocumented and Asana would rather you use opt_fields=num_subtasks to determine if you should look them up.

Unfortunately there’s no equivalent num_stories or num_comments field, and every task is likely to have at least one story when it is first added to a project. So, to find all the comments, you’ll have to query the /stories endpoint for every task.

This is what I have implemented for Ditto, so if there’s a faster way I’d be interested in knowing!