2

We are struggling to mine all time records for this year via API.

We have tried to include the :dont_limit_result GET variable and set it to 1, however it did not help us.

The version that we use is ACTIVE COLLAB 5.11.0, the URL we are hitting: projects?dont_limit_result=1&page=$page

Please give me some advise on how to proceed.

Karl Nicoll
  • 16,090
  • 3
  • 51
  • 65
Karol
  • 21
  • 2
  • Which version of Active Collab are you using? Active Collab 5 does not support that argument, while v4 does, so version number is relevant here. Also, tell me which API URL are you hitting with a request. Please update your question, and we'll answer ASAP. – Ilija Oct 04 '16 at 07:23
  • The version that we use is ACTIVE COLLAB 5.11.0, the URL we are hitting: projects?dont_limit_result=1&page=$page – Karol Oct 05 '16 at 08:36
  • Answer posted. If it helps, please accept the answer so other visitors to SO know that it is a correct answer (or suggest how answer can be improved). – Ilija Oct 06 '16 at 12:55
  • Both of curl commands return empty array "[]" tried with curl also with php api – Karol Oct 12 '16 at 17:10

2 Answers2

0

Most of API responses are paginated, and pagination can't be turned off using a GET switch. Instead, you should check following headers:

  • X-Angie-PaginationCurrentPage - indicates current page
  • X-Angie-PaginationItemsPerPage - indicates number of items per page
  • X-Angie-PaginationTotalItems - indicates number of items in the entire data set.

and walk through pages until you reach the end of data set.

Another option is to give project's filter a try. Here's an example request that will return all projects:

curl -H "X-Angie-AuthApiToken: YOUR-API-TOKEN" "http://your.activecollab.com/api/v1/reports/run?type=ProjectsFilter"

This one will return all active projects:

curl -H "X-Angie-AuthApiToken: YOUR-API-TOKEN" "http://your.activecollab.com/api/v1/reports/run?type=ProjectsFilter&completed_on_filter=is_not_set"
Ilija
  • 4,105
  • 4
  • 32
  • 46
0

I'm using the php API wrapper 3.0 - how do i get the headers back to know there are more pages and then what is the correct form of the query to get further pages?

For example my basic query is:

$timeRecords = $client->get('projects/22/time-records')->getJson();

to get time records - but this only returns 100 and there are more!

Thanks,

P

Pranath
  • 21
  • 1