Show data from an API: Free AI Prompt | SheCodes

Free AI prompt · The Code Book

Show data from an API

A ready-to-use prompt from the chapter API Integration. Paste it into Claude, ChatGPT, Lovable, Bolt or any AI coding tool.

The prompt

“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.”

How to use it

  1. Fill in the blanks with your own details, so the AI builds your project, not a generic one.
  2. Copy the prompt and paste it into your AI coding tool.
  3. Check the result in the preview, then ask for changes one at a time: "make the buttons bigger", "use my brand colours".
  4. Read the chapter to understand why it works and what to do next.

More prompts like this

All prompts

Add a search feature

“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

“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 that saves data

“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.”

Display a list with pagination

“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.”

Show data from my own database

“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.”

Connect to an api

“Connect my app to the [API name] API. I need to [describe what you want to do]. Show me how to make the API call and display the data.”