[API][FR] Add explicit search parameter to GET /types: References [solved]

5 posts • viewed 102 times

This message aims at: suggesting an idea to improve Numista

Status: Implemented
Upvotes: 2
Downvotes: 0

Been running into some issues with narrowing down a type for a given Issuer. I am currently performing the following:

Get /types
issuer=
category="coin"
q="km# " ("km# 111 Real")

In majority of cases this is sufficient enough, but in some cases it isn't.

Consider the Mexico 1820 Mo JJ 8 Reales I attempted (KM111).
Get /types
issuer="mexique"
category="coin"
q="km# 111 Real"

What i got back is (Simplified list)
>>> for n in r['data']['types']:
...   print(n['title'])
...
8 Reales (LCM - Royalist countermarked coinage)
8 Reales - Carlos IV (MVA - Royalist countermark coinage)
8 Reales (Chilpanzingo - Insurgent countermarked coinage)
8 Reales (Chilpanzingo - Insurgent countermarked coinage)
8 Reales (Chilpanzingo and Morelos Countermarks)
8 Reales - Fernando VII
8 Reales - Fernando VII (MVA - Royalist Countermarked Coinage)
8 Reales (JML - Insurgent countermarked coinage)
8 Reales (LVS - Insurgent countermarked coinage)
8 Reales (NORTE - Insurgent countermarked coinage)
8 Reales - Fernando VII (Durango - Royalist coinage)
8 Reales - Fernando VII (Guadalajara - Royalist coinage)
8 Reales - Fernando VII (Guanajuato - Royalist Coinage)
8 Reales - Fernando VII (Zacatecas - Royalist Coinage)
8 Reales - Fernando VII (Chihuahua - Royalist coinage)


What we want is ‘8 Reales - Fernando VII’… Why were all these others included? Well the first one: ‘8 Reales (LCM - Royalist countermarked coinage)’ is because in it's comments, it lists a reference to… “KM#111.1” 

Since it appears the q parameter searches comments and other type fields, its a great catch all… but not great for narrowing down.

# FEATURE REQUEST

Would it be possible to add a ‘ref’ parameter as optional to /types? I assume it would be preferable to have this be generic (ie: not ‘km’ specifically) so that Yeoman, or other references could be checked.

This would allow for:
Get /types
issuer="mexique"
category="coin"
q="Real"
ref='km# 111'

Which would have returned 111 and all subtypes of 111 (111.1, 111.2)
8 Reales - Fernando VII
8 Reales - Fernando VII (Durango - Royalist coinage)
8 Reales - Fernando VII (Guadalajara - Royalist coinage)
8 Reales - Fernando VII (Guanajuato - Royalist Coinage)
8 Reales - Fernando VII (Zacatecas - Royalist Coinage)
8 Reales - Fernando VII (Chihuahua - Royalist coinage)

Or even better, match exactly the KM… 111 only returns ‘8 Reales - Fernando VII’

TIA

Definitely agree in this suggestion but would like to extend it to include more fields, not just the Reference.

 

The filtering available today makes you perform too many queries and return excessive data, not only making it not user friendly but also wasting system resources.

 

An example is when you want to exclude and specific type such as “Patterns”. Another when you want to filter to specific Currency or an interval of years.

 

My suggestion should be that the API search should try to resemble what you have available on the Catalogue in the “Advanced search”. In this scenario the “q” parameter should not even be mandatory, since you have other means of narrowing you search. The name of the parameters used can reflect the names already used by the UI, as a means of a consolidate UX across the several “products”.

 

In this specific case the Reference number is named “no” and the Reference Type is named “ca”.

I agree and I also would like to see an overhaul to the query parameters for this and other end points. 

 

I am not familiar with the setup for the api, so I was hesitant to suggest a huge change like that in hopes of getting this added sooner.

 

If it's all the same effort, then +1 mirror search capabilities.

I am also not familiar with the code base, but I would imagine it will need some effort, since the website search is still based on forms, making code re-usability probably not so straightforward.

 

Anyway, we know how important and central APIs have become and that resources are limited, that is why I pitched in, maybe it will help the process.

Hello,

It's now possible to search by a reference number using the API.

Status changed to Implemented (Xavier, 30 Sep 2022, 11:37)

» Forum policy

Used time zone is UTC+2:00.
Current time is 23:56.