Skip to content

cwissy/api-workshop

 
 

Repository files navigation

Introducing APIs

There are a few core concepts you need to understand in making API requests. By the end of this morning's workshop you should have a mental model of

  • The request-response pattern
  • HTTP methods and status codes
  • XMLHttpRequests
  • The meaning of 'asynchronous' in the context of API requests

The workshop

We will be working in pairs this morning, so figure out who you will be working with. The plan is that each pair should actively read and discuss each topic and try to make sure they both understand the material. How you do this is up to you - you may like to take some time to read separately and then discuss the material between you.

For each topic we will give you 10-15 minutes of reading and discussion time in your pairs, and then we will spend 10-15 minutes asking you questions about the material, and we will pick on pairs at random to answer the questions or explain aspects of the material. We will also attempt to answer any questions you may have for us.

After that we will work on some examples in which we will make API requests.

What to do

Start by adding JSONView a Chrome extension that makes JSON data much more readable in Chrome

Read each section and be ready to answer questions

  1. Request and response pattern

  2. HTTP

  3. XMLHttpRequests

  4. asynchronous code

  5. Example one: fix a broken API request

    • You will need to clone the repository and work on the code locally
    • If you have ssh keys for github: git clone git@github.com:lucymonie/api-workshop.git
    • Otherwise, use:git clone https://github.com/lucymonie/api-workshop.git
    • Open index.html in the browser and you will see that the API request is not working
    • Open main.js and look for what's broken or missing in the code. If you're confused, check it line-by-line against the description of XHR in this file
  6. Example two: write an XHR from scratch

    • Click on the link and clone the repo to your local machine
    • Follow the instructions in the readme

Follow up and further learning

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 72.4%
  • HTML 24.7%
  • CSS 2.9%