Rest API: Task with no associated stories


#1

Briefly describe (1-2 sentences) the Bug you’re experiencing:
One of my projects has a task where the REST API returns no associated stories:

https://app.asana.com/api/1.0/tasks/998379620346838/stories?limit=10
{“data”:,“next_page”:null}

But the task does exist and shows regularly in the UI:
https://app.asana.com/api/1.0/tasks/516439191685342?opt_fields=id,projects
{“data”:{“id”:516439191685342,“gid”:“516439191685342”,“projects”:[{“id”:355262756654789,“gid”:“355262756654789”,“resource_type”:“project”}]}}

Steps to reproduce:
unknown so far

Browser version:
n/a

Upload screenshots below:
Oddly, the screenshot actually shows the creation event (confidential parts pixelated).


#2

Hi @Florian_Schoppmann and thanks for reaching out!

I’ve gone ahead and moved your thread to the #developersAPI category as API questions and bugs are handled independently in this category. My colleagues from the API Team or our experts will be in touch asap! Thank you so much for your patience :slight_smile:


#3

@Phil_Seeman I remember discussing stories with you in a thread and had the feeling you can’t really trust their presence or completeness, correct?


#4

Yes and no.

Yes, it’s correct that some time-based consolidation occurs and as a result, not all change events that occur on a task show up in the task’s stories.

But that consolidation also occurs in the UI display of activities on a task, so in other words, what gets returned by the API should match what displays on a task in the UI.

@Florian_Schoppmann, I wonder about “task created”, though, as shown in your screenshot - I’m not positive that particular event is included in stories. I don’t see it in the list of story information shown here detailing what gets reported: No more parsing story text! New fields on stories!.

If you make additional changes on the task, such that those are displayed in the UI for the task, do you then get those stories returned via the API?


#5

Yes, there doesn’t seem to be a story subtype for task creation, but I would have expected a story with subtype added_to_task (or added_to_project for a top-level task). That’s what I have been using so far to determine the actual task creator – because task objects only have the field created_at, but no field for the person who created it.

In my usage so far, this task was the only one out of several hundreds without any associated stories. Nothing else seems unusual or wrong with this task, though.

For testing as you suggested, I just edited the task description. A new story was created. But no other stories were created retroactively:

{
  "data": [
    {
      "id": 1113183634745720,
      "gid": "1113183634745720",
      "created_at": "2019-03-07T17:57:32.080Z",
      "created_by": {
        "id": 184780349630135,
        "gid": "184780349630135",
        "name": "Florian Schoppmann",
        "resource_type": "user"
      },
      "resource_subtype": "notes_changed",
      "resource_type": "story",
      "text": "added the description",
      "type": "system"
    }
  ],
  "next_page": null
}


#6

Tasks do have an undocumented created_by field:


#7

Oh, that’s good to know. :slight_smile: Thanks! Had I known that before I would have never run into this…


#8

Yeah I get it…

Hey @Joe_Trollo, is this on a list somewhere to add to the docs? :slight_smile:


#9

From the screenshots, the API is behaving correctly—these tasks indeed wouldn’t have any stories on them. The creation story is a fake in the UI, confusingly, but you can get the same information from the created_by and created_at fields as @Phil_Seeman pointed out. We do have a task internally to add created_by to the docs which I’ve pinged again, though I can’t make any promises as to when it will finally be live on our site.


#10

Just in case, to clarify my previous remark: I did not intend to sound sarcastic. The thanks was sincere. :slight_smile: I hadn’t seen the other discussion thread before.


#11

Thanks! As for tasks that are part of a project but do not have any associated stories (see my initial post): Is that something one should expect to happen, or is that a bug? In my tests, this was the only task out of hundreds that didn’t have an associated added_to_task or added_to_project story.


#12

No worries - I didn’t take it as sarcastic!


#13

According to the screenshot, the task is not in any project, so there wouldn’t be any added_to_project story. Additionally, a weird edge case/bug in our product (not just the API) is that the added_to_task story only appears if an already created task is turned into a subtask. If a task is created as a subtask to begin with, the story doesn’t get created. I suspect that’s what happened here: you have a task that was directly created as a subtask and so has no stories on it.


#14

For fun, I just tried to create a subtask without an added_to_task story being created (TAB+S, clicking on the subtask icon, hitting return when editing the name of another subtask). But all of these actually did create a added_to_task story. Maybe the edge case/bug you mention has been fixed? But while playing with it I found the answer: The UI actually allows deleting system-type stories. When hovering over the “…added subtask to task…” story, a small x appears on the right side. My hypothesis is therefore that in the case I described the added_to_task was just accidentally deleted.

So I guess I can answer my own question. There was no bug in what I described, as it’s easy to delete all stories from a task…