You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have been having a user hit our candidate search endpoint and try to search by receipts. This passes validation, but is not a feasible option so error's out.
The root cause:
before running select count(*) query, we should validate argument first,
if {'receipts', '-receipts'}.intersection(
kwargs.get('sort', [])
) and 'q' not in kwargs:
raise exceptions.ApiError(
'Cannot sort on receipts when parameter "q" is not set',
status_code=422,
)
What we’re after
We have been having a user hit our candidate search endpoint and try to search by receipts. This passes validation, but is not a feasible option so error's out.
The call:
https://api.open.fec.gov/v1/candidates/search/?page=1&per_page=20&sort=ways&sort_hide_null=false&sort_null_only=false&sort_nulls_last=false&api_key=DEMO_KEY
In candidates.py line 45
aliases = {'receipts': models.CandidateSearch.receipts}
Action item(s)
(These are the smaller tasks that should happen in order to complete this work)
Completion criteria
(What does the end state look like - as long as this task(s) is done, this work is complete)
References/resources/technical considerations
(Is there sample code or a screenshot you can include to highlight a particular issue? Here is where you reinforce why this work is important)
The text was updated successfully, but these errors were encountered: