# How to call an api to check valid word

i'm trying to write a Wordle clone using SNAP

and somewhere in the process i need to check if the entered word guess is valid ot not.
i know a dictionary api (eg. this checks if the word sugar as valid:
https://api.dictionaryapi.dev/api/v2/entries/en/sugar
if the status is 200, it's a valid word.

how do i use the https blocks to do this>

Fetch the URL, and split by JSON. Check if the title attribute is No Definitions Found. At least that's the best way to do it that I found after I fiddled around the API for a few minutes. (also, it's very slow, have you considered switching to a different one?)

wow it works! thanks for the quick reply. however - you're right - it's strange that it's so slow! when you type the url at the browser, the response is instantaneous! i'll include it in my project and try it.
thanks, again!

I just clicked on the link and it took around 7 seconds for it to respond so it can be slow in a browser as well.

Free databases have to do some sort of traffic regulation to cope with abusive use and being slow to respond is a good mechanism for that.

I've been procrastinating for a few weeks on making a version of Wordle using Snap! myself as it would be a really good exercise

I did start off by finding a list of 5 letter words
https://github.com/cymplecy/5letterWords/tree/main/files

and here is a link to Snap! project with just the words loaded in

ProjectName=5letterWordsCSV

it's working!

i'm almost there - i just have to figure out a way of getting random target words - (right now it's hard coded).
thanks again!

@dardoro thanks for the suggestion - for a 2 player game where players take turn providing a target word, this might work - just cut n paste the word you want although you can't dictate the word length. however i need the target word to be systematically generated and to be always of length 5 . i opted for using a csv of 366 target words and i'll just pick a random word during play. but thanks for the alternative.

i,ve posted snapWordle - my version of wordle written in snap - at the Share Your Projects page.