4

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

http://catalog.data.gov/api/3/action/package_search?q=fish

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

http://catalog.data.gov/api/3/action/package_search?q=fish&rows=1

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.

Thanks.

Dustin Oprea
  • 141
  • 4

1 Answers1

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.

UpQuark
  • 355
  • 1
  • 3
  • 10