How to retrieve ALL TICKETS AT ONCE through a Custom Filter using the API

137 views
Skip to first unread message

Carlos Damasceno

unread,
Jul 6, 2016, 2:42:44 PM7/6/16
to Assembla API Development
The 'best' command I could run:

curl -H "X-Api-Key: ABC" -H "X-Api-Secret: DEF" -H "report=u1364743" -H "page=1" -H "per_page=999" https://api.assembla.com/v1/spaces/SPACEID/tickets.json > output

I have about 200 tickets, but the above command only retrieves 10 records, and each time I run it the returned set contains a different set of records.

Again and important: I need to retrieve ALL RECORDS, not some...

The guys on Assembla Support simply does not know how to do this and asked me to post a question in this group. Does anyone know? Thanks.

Stanislav Kolotinskiy

unread,
Jul 7, 2016, 5:54:17 AM7/7/16
to assembla...@googlegroups.com
Hi Carlos,

you shouldn't send params via headers. So the correct command would be
curl -H "X-Api-Key: ABC" -H "X-Api-Secret: DEF" https://api.assembla.com/v1/spaces/SPACEID/tickets.json?report=u1364743&page=1&per_page=100

The maximum amount of records per page is 100. Please let me know if that helps.

Regards,
Stanislav
--
You received this message because you are subscribed to the Google Groups "Assembla API Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to assembla-api-d...@googlegroups.com.
To post to this group, send email to assembla...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Carlos Damasceno

unread,
Jul 7, 2016, 11:26:49 AM7/7/16
to Assembla API Development
Hi Stanislav, thanks for responding.

I had tried passing the parameters in the URL (as GET), and the result was the same as passing as header. I tried again (now limiting the maximum to 100), and it still returns ONLY 10 records - and always the same 10 records, no matter of what 'page' I pass (1, 2, 3, ...).

I will run this command inside a script, and I need to collect all tickets, not only 100. How can this be done programatically?

Thanks,
Carlos

Jan Myszkier

unread,
Sep 4, 2016, 9:21:03 AM9/4/16
to Assembla API Development
Hey Carlos, 
There's no way to get all of them with one query. Instead you need to create a loop, and when the result contains 100 rows (which might mean there's second page) you need to query another page
That's how I do this at least.
Reply all
Reply to author
Forward
0 new messages