Show data from an API
“Fetch data from [API URL] and display it in a nice card grid. Show a loading animation while it's fetching, a friendly error message if it fails with a retry button, and a message if there are no results.”
Free AI prompt · The Code Book
A ready-to-use prompt from the chapter API Integration. Paste it into Claude, ChatGPT, Lovable, Bolt or any AI coding tool.
“Add error handling to my API calls. Show loading spinners while fetching, error messages when requests fail, and retry buttons.”
“Fetch data from [API URL] and display it in a nice card grid. Show a loading animation while it's fetching, a friendly error message if it fails with a retry button, and a message if there are no results.”
“Add a search bar that filters results from [API URL] as the user types. Show a loading spinner while searching, highlight the matching text in results, and show 'No results found' when nothing matches.”
“Build a weather widget using the Open-Meteo API. Show the current temperature, weather condition with an icon, today's high and low, and a 7-day forecast in a row of small cards. Let the user type a city name to search.”
“Create a contact form with name, email, and message fields. When submitted, save the data to [your database or service]. Show a success message after sending and validation errors if fields are empty.”
“Fetch a list of [items] from [API URL] and show 10 at a time. Add a 'Load More' button at the bottom that fetches the next batch. Show how many total items there are and a loading indicator when fetching more.”
“Create a page that reads [data type] from my database and displays it in a table. Include sorting by each column, and a way to delete individual rows with a confirmation dialog.”