My url:
https://app.asana.com/api/1.0/workspaces//tasks/search?completed=true&teams.any=&completed_on.after=2016-01-01&completed_on.before=2020-01-01&opt_fields=created_at,completed,completed_at,name,notes,workspace,custom_fields.text_value,custom_fields.name,custom_fields.enum_value,custom_fields.number,custom_fields.number_value&limit=2&opt_pretty=true
I was getting pagination results but stopped getting them last week sometime. I have tried changing the limit=?? to different numbers and tried removing the opt_pretty=true.
I have tried this on a web browser and do not receive anything back for next_page, just tasks.
I doesn’t look like I can edit my post. I placed “remove” with two square brackets in the URL for workspace and teams. The forum looks like it removed my removes. To be clear, when I use my url I DO get results.
Hi @Eric_Snyder,
I’m actually not sure how you were getting pagination on that endpoint at all - the Search API does not support pagination. For details, see:
Thanks Phil. Perhaps I was getting pagination using a different URL. Thanks for clearing that up.
Well…this is what the docs actually say:
Pagination
Search results are not stable; repeating the same query multiple times may return the data in a different order, even if the data do not change. Because of this, the traditional pagination available elsewhere in the Asana API is not available here. However, you can paginate manually by sorting the search results by their creation time and then modifying each subsequent query to exclude data you have already seen. Page sizes are limited to a maximum of 100 items, and can be specified by the limit
query parameter.
When it says:
to esclude the data you have already seen
Does one exclude by task ID in the query url or by setting the start date to be a millisecond after the most recent created date that was returned last query? I am especially concerned with that statement:
repeating the same query multiple times may return the data in a different order, even if the data do not change
This seems like making sure I get a complete list of results is not actually possible.
Yes, this. (Just to be nit-picky, when you say “start date” I assume you don’t mean the Asana start_date
field but rather the starting created_at
date to use for the next search request.)
Per @Joe_Trollo of Asana: