Baby's First API Call

October 15, 2021

Today I’m making a very simple asynchronous API call.

Agify takes a name as input and returns a JSON object with fields for the input name, a predicted age, and a count. Not sure what the count is - could be number of data points, number of times queried, number of people with that name and that age, etc. I couldn’t find documentation on it.

This is the easiest kind of API to use. It doesn’t require a token or an account, just a URL. Each call to the API takes an input and combines it with a base URL to create the request.

I’m using the Fetch API to make the HTTP request. The JSON is extracted from the HTTP response, and if the age field exists, it’s displayed. Code’s here!

Enter your first name!