When I hit the "package_search" action API at data.gov, 26564 results are currently returned:


When I pass the "rows" parameter to limit the results, it seems to be ignored and I still get 26564 results returned:


However, when I pass an unrecognized parameter, I get an error saying so. So, it's recognizing the "rows" parameter but seemingly not applying it.

Also, http://docs.ckan.org/en/latest/api/index.html says that the parameters should in fact be sent as a JSON payload. It provides an example using the "HTTPie" utility to pass the "id" parameter to the "group_list" action API:

http http://demo.ckan.org/api/3/action/group_list id=data-explorer

However, I get the same result whether I pass "id=data-explorer" or any "id=(string of random characters)". The same goes for making a proper request directly from Python, too.

What am I missing? This is really annoying.


1 Answer 1


So with a little fiddling, it looks like the field is actually working. The "count" remains unchanged, and I assume it refers to the total number of members in the dataset. However the actual number of results returned is correctly limited by the rows argument.

So you'll notice http://catalog.data.gov/api/3/action/package_search?q=fish&rows=0 includes count: 26665 but the actual results array is empty. If you look at the results array from http://catalog.data.gov/api/3/action/package_search?q=fish&rows=2, there are two entries in it. If you're not using one already, JSON viewer extensions are nice for reading through the response in browser.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.