CPNT 262 Day 10 - `fetch()` and Asynchronous Javascript

Housekeeping

Trophy of the day

  • A page displaying data fetched from an API!

1. Spoiler Demo


2. Postman and JSON Placeholder

Materials

Activity

  • Using Postman and JSON Placeholder:
    1. Retrieve a list of albums;

      GET https://jsonplaceholder.typicode.com/albums
      
    2. Choose a record from the returned JSON and retrieve the data for just that record by using it's id:

      GET GET https://jsonplaceholder.typicode.com/albums/:id
      

3. Basics: Asynchronous Javascript


4. Fetching data with fetch()

Materials

Activity


Prep

Asynchronous Javascript

fetch() and JSON

Public JSON APIs

  • Using this List of Public APIs, find an endpoint (a URL that returns a json object, not an HTML page) that returns an array of objects. You will use this for an activity tomorrow.