<commit_before># 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
Read each section and be ready to answer questions  

1. [Request and response pattern](https://github.com/lucymonie/api-workshop/blob/master/01-request-response.md)  

2. [HTTP](https://github.com/lucymonie/api-workshop/blob/master/02-http.md)  

3. [XMLHttpRequests](https://github.com/lucymonie/api-workshop/blob/master/02-xmlhttprequest.md)  

4. [asynchronous code](https://github.com/lucymonie/api-workshop/blob/master/03-asynchonous.md)  

5. Example one: [fix a broken API request](https://github.com/lucymonie/api-workshop/tree/master/api-example)  
    - You will need to clone the repository and work on the code locally
    - Go to your terminal and enter:`git clone <EMAIL>: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](https://github.com/lucymonie/api-workshop/blob/master/02-xmlhttprequest.md)

6. Example two: [write an XHR from scratch](https://github.com/skibinska/xhr-workshop)
    - Click on the link and clone the repo to your local machine<commit_msg>Updates readme to fix file numbers in links<commit_after># 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
Read each section and be ready to answer questions  

1. [Request and response pattern](https://github.com/lucymonie/api-workshop/blob/master/01-request-response.md)  

2. [HTTP](https://github.com/lucymonie/api-workshop/blob/master/02-http.md)  

3. [XMLHttpRequests](https://github.com/lucymonie/api-workshop/blob/master/03-xmlhttprequest.md)  

4. [asynchronous code](https://github.com/lucymonie/api-workshop/blob/master/04-asynchonous.md)  

5. Example one: [fix a broken API request](https://github.com/lucymonie/api-workshop/tree/master/api-example)  
    - You will need to clone the repository and work on the code locally
    - Go to your terminal and enter:`git clone <EMAIL>: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](https://github.com/lucymonie/api-workshop/blob/master/02-xmlhttprequest.md)

6. Example two: [write an XHR from scratch](https://github.com/skibinska/xhr-workshop)
    - Click on the link and clone the repo to your local machine
{'fraction_non_alphanumeric': 0.07256333190210391, 'fraction_numerical': 0.010304851867754402, 'mean_word_length': 3.9353813559322033, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '548091', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1281, 'n_words': 622}