WGBH-MLA / AAPB2

American Archive of Public Broadcasting
https://americanarchive.org/
Other
25 stars 9 forks source link

BUG: JSON API endpoint for catalog records doesn't work with old-style AAPB IDs having underscore #2773

Open afred opened 1 month ago

afred commented 1 month ago

Replicate

Done when

Links with old-style IDs work.

Background

The IdHelper class in /app/helpers/id_helper.rb is used to solve this problem for non-API URLs:

Notice that we don't do redirecting here. There are pros and cons to not redirecting, but I think right now staying consistent within the code probably has more net value than enforcing the canonical new-style URLs through redirection. So let's stay consistent by not redirecting unless somebody has a more compelling argument for switching to a redirection strategy.

foo4thought commented 1 month ago

this is not a bug; some IDs actually use the underscore and can be summoned using that explicitly or with a single-character wildcard.
mylocal:~ kevincarter$ curl -sS 'https://americanarchive.org/api.json?q=id:cpb-aacip&fl=id&rows=1&start=0' { "responseHeader": { "status": 0, "QTime": 283, "params": { "q": "id:cpb-aacip_", "fl": "id", "start": "0", "rows": "1", "wt": "ruby" } }, "response": { "numFound": 2253000, "start": 0, "docs": [ { "id": "cpb-aacip_211-70msbxxf" } ] } }

foo4thought commented 1 month ago

oof - I see you're using a different method. I guess that's a bug but I always use the parameter q=