Hearthstone

FREE
By omgvamp | Updated 9 दिन पहले | Entertainment
Popularity

9.7 / 10

Latency

2,477ms

Service Level

99%

Health Check

N/A

Back to All Discussions

Support fuzzy search by name

Rapid account: Mr Mint
MrMint
9 वर्ष पहले

Would it be possible to add support to the single card endpoint (or a new endpoint) that allows searching for cards by partial name match?

ie: query with name of “Yse” returning ysera and any other cards that contain the string “yse”.

Thanks!

Rapid account: Mr Mint
MrMint Commented 9 वर्ष पहले

Looks great! Appreciate the quick support!

Rapid account: Omgvamp
omgvamp Commented 9 वर्ष पहले

I’ve added a new endpoint to support this. The endpoint is called “Card Search”. Check the documentation for more info.

Rapid account: Mr Mint
MrMint Commented 9 वर्ष पहले

Sorry about the delayed response!

I can understand your concern, but auto-complete is not the use case I am looking to address. The use case here is for a hipchat bot, where users are able to type a command such as /hearth card ysera, which will result in the bot posting a message to the room with some details on the card. Due to not being able to implement an autocomplete within hipchat, this means they need to spell the card name 100% correctly to get a result from the api.

And while I could indeed just seed a database and implement an api for it myself, that defeats the time savings of using a great api like this!

The bot currently supports magic the gathering, using this api https://deckbrew.com/api/

The bot:
https://github.com/MrMint/NerdBot

Rapid account: Omgvamp
omgvamp Commented 9 वर्ष पहले

If your developing some sort of app where users can search for cards in a search box by typing the cards name and it auto completes their search, the best practice would be for you to request “All Cards” from the API and store that data in some kind of database. Then perform the search on the data in your own database.

From an API standpoint providing a partial name endpoint wouldn’t necessarily be an issue but you can imagine that if everyone using the API would request cards while users are typing into a search box the amount of requests would be exponential, and thus the quality of the API would degrade.

I suggest you store the cards data in some kind of database and perform a search on that instead of having to hit the API multiple times.

If you had a different use in mind don’t hesitate to reply!

Join in the discussion - add comment below:

Login / Signup to post new comments