Completed Tasks List : True-False

#1

Hello Everbody ,my purpose is When user selected project, ı wanna list just completed Tasks of Project False.
As you can see my code :blush:

  • var settings_test = {
  • “url”: “https://app.asana.com/api/1.0/projects/” + okunanidd + “/tasks?opt_fields=id,created_at,modified_at,name,notes,assignee,completed:‘true’,assignee_status,completed_at,due_on,due_at,projects,memberships,tags,workspace,num_hearts,parent,hearts,followers,hearted&completed_since=2016-10-07T22:54:00.867Z”,
  • “method”: “GET”,
  • “timeout”: 0,
  • “headers”: {
  • "Authorization": "*******************************"
    
  •                 },
    
  •             };
    
  •             $.ajax(settings_test).done(function (response) {
#2

Can you try to format your code use triple backquote before and after, alone on their line? That will make things easier to read :wink:

What is the result of your request?

#3

Hello thank you for help againg :slight_smile: Normally When ı selected a project , I can list Tasks Of Selected Project .Everything is good . now , ı wanna do it As give an example, When ı selected a project , at this time ı wanna see True Tasks Of Selected Project . unfortunatelly my code is show (True,False,All) Tasks Of Selected Project .

var settings_test = {
“url”: “https://app.asana.com/api/1.0/projects/” + **selectedProjecetID **+ “/tasks?opt_fields=id,created_at,modified_at,name,notes,assignee,completed,assignee_status,completed_at,due_on,due_at,projects,memberships,
“method”: “GET”,
“timeout”: 0,
“headers”: {
“Authorization”: “*******************************”
},
};
$.ajax(settings_test).done(function (response) {

Thank You

#4

You only want completed tasks in the project, correct?
Thanks for the code formatting!

1 Like
#5

There is no way to apply filters in the API. You’ll have to get back all of a project’s tasks and do the filtering on your end to only show completed tasks to the user. The only way to in effect do filtering is to use the Search API, where you can specify criteria like Completed.

1 Like
#6

If I am not mistaken, you don’t get the completed tasks returned by default however, and you need to include the completed flag in the fields you request, correct?

'opt_fields': 'name,html_notes,tags,tags.name,due_on,completed,assignee,assignee.name,assignee.photo'
1 Like
#7

Um, it’s just come to my attention that my previous answer above is partially incorrect.

As I said above, normally you can’t do filtering on the tasks query endpoint.

However, I just saw there is one special case you can use on that endpoint to return only incomplete tasks, namely ?completed_since=now, or to filter by completed date. It’s documented here.

3 Likes