tcgdex / cards-database

Pokémon Trading Card Game Card (TCG) Database for the TCGdex API. ⭐ Leave a star if the project interest you !
https://www.tcgdex.net
MIT License
182 stars 41 forks source link

enhancement: Add or modify cards endpoint to include more details #594

Closed dsnidr closed 1 day ago

dsnidr commented 3 days ago

Data affected

Please explain in more details what idea you have

My Use-case

I have an app which periodically fetches data for all cards and builds a local mirror to avoid spamming API requests.

Currently, the only way to fetch the details I need using this API is to fetch cards one by one. There is the GET /v2/en/cards endpoint which will return partial data on all cards, but does not include fields I need such as:

Proposed Solution

I propose a paginated endpoint which will return full card objects, but only up to a sane limit (e.g 50 at a time). Ideally, it would also support basic sorting and other standard operations.

Having a paginated endpoint returning full card details would have the following benefits:

  1. Make the API easier and faster to work with
  2. Reduce load on the API by avoiding the overhead associated with tens of thousands of individual requests to fetch all cards
  3. It could provide a count of the total number of cards in the database

I'm happy to give this more thought and take up the implementation if this idea is well received.

Aviortheking commented 3 days ago

Hey, for this use case, you can use the GraphQL API. It is made for these use cases

dsnidr commented 3 days ago

Great! I'll just use that, then.

Do you think it's worth exploring a REST option for those who don't want to use GraphQL? If not, feel free to close this.

Thanks! :smile:

Aviortheking commented 1 day ago

You're welcome !

There is something that is meant to kinda add this in #606 (Strangely it was on the Discord but I forgot to add it to the Github)