Stepthrough Start free

JavaScript: Pull Contacts from an API into a Table

Practice it step by step

Start the free practice

Take the free module: why it matters, practice and a quick check →

You do every step yourself in a practice copy of JSFiddle. It checks your work as you go, and “Do it for me” finishes any step you get stuck on. Free, about 12 minutes, and nothing touches your real accounts. Open full screen

Free · Live nowJavaScriptJSFiddle~12 min9 stepsBeginner

Updated . Built against the tool’s current screens and checked step by step. How we check this lesson

A beginner JavaScript walkthrough in the free JSFiddle: fetch contact data from a free practice API and show name, company and email in a table, typing every line yourself.

At a glance

QuestionAnswer
What you buildA beginner JavaScript walkthrough in the free JSFiddle: fetch contact data from a free practice API and show name, company and email in a table, typing every line yourself.
ToolsJSFiddle
TimeAbout 12 minutes, 9 steps in 3 parts
LevelBeginner, no coding needed
CostFree
Ways to learn itPractice it step by step

The 3 parts, in short

  1. Look at the data: Find the fields you need.
  2. Fetch it: A heading and an empty table, The address and the table, Fetch the data.
  3. Build the table: Header row and a loop, One row per contact, Call it, Tidy the code, and 1 more step.

Start here first: JavaScript: An Instant Quote Calculator for Your Website (module 1 of JavaScript)

The JSONPlaceholder users address in Chrome: a list of users with name, email, address and company
The JSONPlaceholder users address in Chrome: a list of users with name, email, address and company

What you'll build

Most business tools, from CRMs to accounting apps, share their data through an API: a web address that answers with data instead of a page. A sales assistant who copies contacts from the CRM into a spreadsheet by hand every week can let ten lines of JavaScript do it. In this lesson you fetch ten made-up contacts from JSONPlaceholder, a free practice API, and show them in a table in JSFiddle. You type every line yourself.

Ten contacts, each with a name, a company and an email, read from an API and written into a table by your own code. A real CRM API works the same way, plus a key that proves who you are. Do it in JSFiddle yourself: the lesson page has the checklist.

  • Tools: JSFiddle
  • Time: about 12 minutes, 9 steps in 3 chapters
  • Level: beginner, no coding needed
  • Price: free

Practice first, then build it for real

Practice copy built from real JSFiddle screens (jsfiddle.net, captured 24 October 2026). Every line of code in it was typed and run there. The business and its numbers are made up; the ad box on the left is blurred. To build it for real you need your own JSFiddle account, and some services charge once you use them for real work, so check each tool's current pricing.

Try it yourself, free

Reading the steps is a start. Doing them is how it sticks. The interactive module walks you through every click in a practice copy of JSFiddle, checks each step, and never touches your real accounts.

Start “JavaScript: Pull Contacts from an API into a Table”

Step by step: JavaScript: Pull Contacts from an API into a Table

All 9 steps of the interactive module, in order. In the module you watch each one, then do it yourself in a practice copy that checks your work.

1. Look at the data

  1. Find the fields you need. This is jsonplaceholder.typicode.com/users opened in the browser: ten made-up users as JSON, the format almost every API answers in. Each user has a name, an email and, inside company, a company name. Click the "company" line.

    This is a free practice API. Each user has a name, an email, and a company with its own name.

2. Fetch it

  1. A heading and an empty table. Open jsfiddle.net (no account needed). In the HTML panel type a heading and an empty table. JSFiddle often adds the closing tag for you as you type; if you end up with a doubled one or a stray >, delete it.
  2. The address and the table. In the JavaScript panel type the API address and find the table.
  3. Fetch the data. Leave a blank line. fetch asks the address for the data; await waits for the answer; .json() turns it into a list you can use.

    Fetch asks the address for the data, await waits for the answer, and json turns it into a list.

3. Build the table

  1. Header row and a loop. Write the header row, then start a loop that runs once for each user.
  2. One row per contact. Add a row with the three fields, then close the loop and the function. u.company.name reaches inside company for its name.

    Add one row per user with the name, the company name and the email. Then close the loop and the function.

  3. Call it. Leave a blank line and call the function, so it runs when the page loads.

    Call load, so it runs when the page opens.

  4. Tidy the code. Point at the JavaScript panel and click the tidy icon.
  5. Run it. Click Run.

Screenshots

Start this module free

More in JavaScript

All 3 modules in JavaScript

Free cheat sheet

Print it or save the PDF: the key steps and checks from this lesson on one page, free.

All free printable cheat sheets

Plain-English definitions, each with an example from a free lesson.

The full AI glossary

Browse related tutorials