400 Bad Request via getting over 100 tasks

Hello! I created a request in Asana, but I found that if there are more than 100 tasks, I get a 400 Bad Request error. Is it possible to bypass this limitation?

$url = “https://app.asana.com/api/1.0/projects/{$project_id}/tasks?opt_fields={$opt_fields}&opt_expand={$opt_expand}&due_on.after={$start_date}&due_on.before={$end_date}&limit=1000”;

Hi,

This endpoint is using pagination, you can see it on my image.

You should use the official client librairies which handle pagination for you.

Can’t I make a simple HTTP request with an offset parameter without using a library?
Those. $url = “https://app.asana.com/api/1.0/projects/{$project_id}/tasks?opt_fields={$opt_fields}&opt_expand={$opt_expand}&due_on.after={$start_date}&due_on.before ={$end_date}&limit=100&offset=100”;

won’t work?

Of course you can :slight_smile:

But this request returns 400 status code

The idea is that I need to get more than 100 tasks on one page in order to process them further.

It seems you are using the wrong parameters also.

Parameters like “due_on.after” are only for the endpoint search for tasks in a workspace.
In the endpoint you are using, the offset is sent in the response of the previous page, and you send it to get the next page. It’s not a number that you can provide.

1 Like