Fetching Data

Housekeeping

  • Ash covering Thursday Lab Time

1. Spoiler Demos

2. Introduction to Asynchronous JS

Materials

Slides: Asynchronous Javascript

3. Fetching JSON Data

Materials

Demo: Fetching data from JSON Placeholder

4. Utility function: randomIndex()


Lab Time

Public JSON APIs

  • Try using fetch() to retrieve placeholder data from JSON Placeholder, such as:
  • Here's a list of some of Tony's favourite APIs to get you started with real data.
  • Using this List of Public APIs, find an endpoint (a URL that returns a json object, not an HTML page) that returns either an object or an array of objects. You will use this for an activity tomorrow.
    • Tips - pick APIs where:
      • Auth is no
      • CORS is yes

Prep