0

I have the following cURL cmd running which returns all tasks for a specific userID within a specific workspaceID, but the "completed=false" part of the cmd doesn't influence the data returned. I am trying to exclude all "completed" tasks. Everything else is working as I expected. Below is the current cmd string and a snippet of the data returned back. As you can see one of the returned tasks indicates "completed" is true while the other indicates false.

Anyone see what I may be missing? Thanks in advance for your help.

cURL cmd:
curl -u <api-key>: "https://app.asana.com/api/1.0/tasks?workspace=<workspace>&assignee=<teamMemberId>&completed=false&opt_fields=name,assignee,assignee_status,notes,created_at,modified_at,completed_at,due_on,completed&opt_pretty"

output (partial)
{
  "data": [
    {
      "id": <ID>,
      "created_at": "2014-03-11T03:34:52.002Z",
      "modified_at": "2014-03-11T23:33:07.544Z",
      "name": "<nameoftask>",
      "notes": "",
      "assignee": {
        "id": <ID>
      },
      "completed": true,
      "assignee_status": "upcoming",
      "completed_at": "2014-03-11T23:33:06.729Z",
      "due_on": "2014-03-11"
    },
    {
      "id": <ID>,
      "created_at": "2014-03-11T23:33:07.196Z",
      "modified_at": "2014-03-11T23:33:07.196Z",
      "name": "<nameoftask>",
      "notes": "",
      "assignee": {
        "id": ID>
      },
      "completed": false,
      "assignee_status": "upcoming",
      "completed_at": null,
      "due_on": "2014-03-14"
    },
Racil Hilan
  • 24,690
  • 13
  • 50
  • 55

1 Answers1

0

TL;DR: You want completed_since=now, not completed=false.

The GET /tasks endpoint doesn't take a parameter completed - it does however take completed_since, which can take a timestamp (as provided by JS's .toISOString()) or the string "now". It always includes incomplete tasks. This is documented in the API Docs on Tasks (specifically the section on "Querying for tasks").

We're looking to improve the way you can filter tasks, but for right now what's documented there is all there is.

agnoster
  • 3,744
  • 2
  • 21
  • 29
  • completed_since=now worked perfectly. I really appreciate the feedback. I poured over the docs before posting, and checked again now, but still don't see anything about completed_since=now. Would never have gotten there w/o your help. Thank you again. – user3418032 Mar 15 '14 at 01:07
  • From the docs: `completed_since` Only return tasks that are either incomplete, or completed since the given time. **Note:** You can also specify now to represent the current time. – agnoster Mar 15 '14 at 06:29
  • However, I agree the docs aren't as clear as they could be. We'd like to do a complete overhaul (they've just sort of grown organically, but clearly are past the limit of what should be on a single page). – agnoster Mar 15 '14 at 06:32
  • my bad - I see the detail in the docs now -- i was looking at the top of the Tasks section where it lists the accessible fields and thought that was the limit...I should have kept reading. Thanks again. – user3418032 Mar 15 '14 at 17:10