Open hminsky2002 opened 2 weeks ago
Surprising, I am looking at API now to verify! @hminsky2002 is right, we only allow paginated GET
of all sources or GET
by internal PDC id
. So there is no reliable way to get one by text one knows is in a short code.
I don't think we need a full blown search (unless there is a use case I'm not familiar with)
What we do want is the ability to filter by a known foreign key value! I just updated the issue to reflect that.
Simple query filters by those IDs is easier and more precise. I assume multiple query parameters would be interpreted as requesting intersection and not union, given that each is a filter -- or an error to provide two of these filters. Handling that situation is the only weird part.
I assume multiple query parameters would be interpreted as requesting intersection and not union, given that each is a filter -- or an error to provide two of these filters. Handling that situation is the only weird part.
Yes to intersection!
My .02 is that the correct behavior isn't an error, but just returning an empty set. That's ok, the client would figure it out. It's predictable and consistent (and technically valid -- just not a particularly meaningful thing to query)
This came up during work on front-end issue 836(https://github.com/PhilanthropyDataCommons/front-end/issues/836), and the case is as follows: if a user were to want to retrieve a Source by shortcode, they would need to fetch all Sources present in the database, and filter client-side. We've standardized on pagination parameters for most of our entity-retrieving endpoints, perhaps it would be worthwhile to consider some sort of search query, where in one could pass any/all relevant fields that they are searching for.