---
# System prepended metadata

title: Api intro questions
tags: [WebAhead]

---

# Api intro questions

###### tags: `WebAhead`

#### Request & Response:

1) does everyone understand request/response ? <!-- with strings --->
2) What is the reponse property responseText?
3) What is JSON?
4) whats is JSON.stringify and JSON.parse ? [click me for code](https://jsbin.com/sujapuk/2/edit?js,console)
5) Why should you wrap JSON.pare() in a `try...catch` block?

#### HTTP:

- http is a mechanism
- draw the `http://www.google.com/index.html` on a whiteboard
- what is a get request ?
- what is a post request ?
- draw status codes: 200, 404, 500. explain that these are the most famous ones.

#### The fetch API:
- draw the fetch code on the board
```javascript=
fetch('https://api.github.com/users/chriscoyier/repos')
  .then(function(response) {
    return response.json();
  })
  .then(function(data) {
    // Here's a list of repos!
    console.log(data);
  })
  .catch(function(error) {
    console.log(error);
  })
```

#### Asynchronous
- short helpful code [click me](https://jsbin.com/yezanun/1/edit?js,console)

#### Follow up and further learning
