BirdsCanada / NatureCountsAPI

NatureCountsAPI
0 stars 1 forks source link

Maximum number of options for filters #11

Closed steffilazerte closed 5 years ago

steffilazerte commented 5 years ago

This is perhaps a bit silly, but I was creating an example today of wanting to download data on all mice/voles/etc in the Muridae family.

I show how to filter the species_taxonomy down to all the species in the Muridae family. Because there's currently no way to know which of those species are in the data base, I was going to just throw all the species at the API and see which were returned (I expected 90% of them to return nothing).

However, there are 1331 species and I got an HTTP 404 error. If I reduce the list to 210 species, I don't get the error.

I can loop over species to download them all, but I wanted to know if this is a hard and firm cutoff, or something more flexible that I should get some more information on before proceeding.

pmorrill commented 5 years ago

Are you using http GET? or POST? I think you are using POST, so there should be no limit on the parameter size. But if the parameters are truncated that could lead to garbled request content - a GET would certainly truncate that size of request, I believe.

A 404 is otherwise a bit strange to see - more likely a server 500 error if the list of species is too large.

Can you send me the query string, in an email or text file?

steffilazerte commented 5 years ago

I'm using GET, so that's probably the issue. I guess I'll just switch to POST? Any reason not to?

I was wondering about the 404 too. Anytime I accidentally send an incorrect filter name (like this morning, when they changed), I get a 404 error, which is a bit misleading.

I can still send you the query string, but I imagine it's not useful as I was using GET?

pmorrill commented 5 years ago

OK - definitely switch to post and let me know if you run into problems!

Good point re the error code. My errors are structured as 2 levels: the http code plus a message in EN. I need to review those actual codes that I use, and think that out / test again.

steffilazerte commented 5 years ago

Is the POST method enabled for all entry points? I'm running into "Method Not Allowed (HTTP 405)" errors for everything I've tried, but I'm not 100% sure what the body is supposed to be called (if it's supposed to be called anything in particular?)