"Get tasks from a project" API returned not sorted data


I’m using “Get tasks from a project” API for store data into my database.

when I call that API that returned not sorted data

I need to check Task gid is in database exist or not

but when I call api that return like this

example :
gid : 10
gid : 11
gid : 9
offset : next key

if there is not sort function, I should be call api until that api return no offset data for compare my database. because I have not ensure data consistency

or please let me know, “Get tasks from a project” API have any default return order rules?

like creation time or modify time or complete time etc…


Hi @andy39 and welcome to the forum,

That endpoint does not guarantee any particular return order of tasks.

To get tasks in a particular order of your choosing, you should instead use the Search API. As you can see in the docs, it lets you specify a sort_by parameter.

(Note that unlike most other endpoints, this one doesn’t provide pagination; instead you have to do your own pagination as explained in the “Pagination” section of the docs there.)

1 Like

Hi @andy39

@Phil_Seeman is right, the only method you can control the sort order is from the “search” endpoint. But paging is more difficult to do.

But, the sort order you see when you request tasks for a project using the standard endpoint, is the order you see on screen.

You can drag tasks to change order in a project.
And the api is returning tasks in that order.
It looks like random, but it’s not :slight_smile:

Look at this sample I just tried:


Then I drag “brief” to the end, and call the api again.


1 Like

Good point, @Frederic_Malenfant , thanks for clarifying that!

1 Like

Thanks. all

I resolved that issue using search API and filter and sorting.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.