-
Notifications
You must be signed in to change notification settings - Fork 137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API response when term None is requested #2188
Comments
This is Python you're working from? I'm not sure if a None there will send us the string "None" or just a blank for the term parameter. Anyway I think the behavior you're seeing is just down to the API ignoring term parameters that don't "look like" a valid term (i.e., a string with a colon in the middle), and treat it as if nothing was passed. |
Indeed, it's python (sorry for that imprecision) |
Do you have the "results per page" in General Settings set to 1 in your local installation, or are you otherwise only fetching 1 result? If you pass a query parameter of "" or "None" or anything lacking a colon as the value for "term", it should fail the @zerocrates I tend to agree that it would make more sense and would make the API easier to navigate if an error message was returned when a malformed query fails a validation-like check, for example by having |
The API generally is purposely tolerant of "empty" arguments as it's simpler to hook that up to an HTML form, so where rejecting empty-string arguments overlaps with some other validation we often take the simple route and treat both the same and just ignore them both. I don't know also that we're well set up to, for example, return 400 on these at the moment... the systems we otherwise use for reporting and collecting errors aren't used on the query side of the API. |
@alexdryden you got it! thanks I use this method (link to the line in github) of python omeka_s_tools. I understand the design of a tolerant REST API. |
When I request the REST API with (example)
http://localhost/api/resource_classes/ params={'term': None}
As there is no class with
None
value as term,the API should give no results.
But It gives me the http://localhost/api/resource_classes/1
(which term is
dcterms:Agent
FYI)Strange behaviour... could you fix it?
The text was updated successfully, but these errors were encountered: