[API][v3] /types not honoring some params

Pubblicazioni di 4 • visto 67 volte

Questo messaggio ha lo scopo di: segnalazione di un difetto

Stato Respinta
Voti positivi: 0
Voti negativi: 0
Hey, Thanks again for the API Update. Found something.

Looks like a few parameters on the `/types` endpoint are being discarded somewhere in favor of defaults.

page, count, and category.

Looks like the defaults of `page=1` and `count=50` can't be overridden, and category is appearing to default to `category={any}`

A query like so:

`curl -o ./results -X GET -H "Numista-API-Key: $numista_api_key" -H "Accept: application/json" -H "Content-Type: application/json" https://api.numista.com/api/v3/types?q=peso&category=banknote&page=1&count=10`

would yield way too many results for that category and count

```
cat results | jq '. | length'
4719
50
```

Looking at the data confirms that I'm getting coins, exonumia, etc.

let me know if you need more data.
Hello,

I believe the issue is coming from your curl command. I managed to get the expected results by adding quotes around the URL:

curl -o ./results -X GET -H "Numista-API-Key: 7LBXCmeLwY6D3PZSYv1h2NNrEU6oscAtdaJSGr3E" -H "Accept: application/json" -H "Content-Type: application/json" 'https://api.numista.com/api/v3/types?q=peso&category=banknote&page=1&count=10';
I can confirm that those parameters are respected, as I explicitly test them in my (still incipient) test suite and the tests keep passing after upgrading from v2 to v3. (In those tests, searchCoins is just an alias for search with category set to coins.)
https://github.com/leopiccionia/numista-sdk/blob/develop/tests/search.spec.ts
Ugh, yep. You are (both) right.. not sure how I missed that :sweat:
Stato cambiato a Respinta (Xavier, 30 Mar 2022, 17:06)

» Politica del Forum

Il fuso orario utilizzato è UTC+2:00.
L'ora attuale è 03:22.