Im currently pulling in all Hardware created after a set date, but i cant easily see a way to get the last 20 entries? Whats the best way to do this?
Something like https://api.samanage.com/hardwares.json?last=20 would be perfect if it was a thing.
Hi erron, if you add ?per_page=20 you should have the result you're looking for. It's referenced in the API documentation under General Concepts > Paginationhttps://apidoc.samanage.com/#section/General-Concepts/PaginationHope that helps!
I did see that but didnt see any way to get the mostly recently created items in that page of 20.
Great question! I never thought to test/use this.
You can achieve something similar to what you're requesting by requesting per_page=20, page=1, and then using the sort_by= and sort_order= arguments to change the order in which the results are filtered.
For example, to get the newest 20 incidents:
https://api.samanage.com/incidents.json?per_page=20&page=1&sort_by=created_at&sort_order=DESC
For the oldest 20 incidents:
https://api.samanage.com/incidents.json?per_page=20&page=1&sort_by=created_at&sort_order=ASC
You can discover the different options by sorting the columns in the web interface, and then looking at the arguments that show up in the URL afterwards. This should work for other endpoints in addition to /incidents