BMI Presentation 2:

HTTP requests and responses

Lesson Objective

By the end of this lesson you should be able to identify HTTP request and response types

Where Are We?

  1. What We're Covering

  2. Assumptions
  3. Why is this important?
  4. HTTP is like communication, let's communicate!
  5. Difference between the client (requester) and server (responder)
  6. Explain the types (methods) of a request
  7. Explain the types (statuses) of a response
  8. Examples
    a. Example 1
    b. Example 2

  9. Exercise!

Where Are We?

  1. What We're Covering

  2. Assumptions

  3. Why is this important?
  4. HTTP is like communication, let's communicate!
  5. Difference between the client (requester) and server (responder)
  6. Explain the types (methods) of a request
  7. Explain the types (statuses) of a response
  8. Examples
    a. Example 1
    b. Example 2

  9. Exercise!

Assumptions

  • You know and use the internet.
  • HTTP stands for Hypertext Transfer Protocol.
  • You love cats

Where Are We?

  1. What We're Covering

  2. Assumptions
  3. Why is this important?

  4. HTTP is like communication, let's communicate!
  5. Difference between the client (requester) and server (responder)
  6. Explain the types (methods) of a request
  7. Explain the types (statuses) of a response
  8. Examples
    a. Example 1
    b. Example 2

  9. Exercise!

Why is this important?

How does google return your search results to your device?

How does a web page just appear on your device?

How do your mom/kids see what you do on facebook?

When you login to Instagram how do they know it's you?

How do you think your devices talk to Google, Facebook, and websites in general?

Where Are We?

  1. What We're Covering

  2. Assumptions
  3. Why is this important?
  4. HTTP is like communication, let's communicate!

  5. Difference between the client (requester) and server (responder)
  6. Explain the types (methods) of a request
  7. Explain the types (statuses) of a response
  8. Examples
    a. Example 1
    b. Example 2

  9. Exercise!

What's talking like Dan?

Speaking and communication shouldn't be taught from me.

 

Though there are a lot of parallels between how computers talk and how we talk.

Me

You

Air between us

The magic of speech and conversation happens here!

Someone asks/gives info

1. Someone requests or gives information

Me

You

Request or gives info

Air between us

A Response is given

2. A response (or lack thereof) or acknowledgement is given back to the original person.

Me

You

Response to request

Air between us

Repeat and Change roles

3. This happens and we change roles of who is giving information and who is responding to it, even

Note: This is very simplified view of conversation as it can be very complicated.

Computers 

Computers Communication in a really similar way, except they don't change roles.

Clients

Server

Requests to give or ask for information.

Responds to the request from the client.

Where Are We?

  1. What We're Covering

  2. Assumptions
  3. Why is this important?
  4. HTTP is like communication, let's communicate!

  5. Difference between the client (requester) and server (responder)

  6. Explain the types (methods) of a request
  7. Explain the types (statuses) of a response
  8. Examples
    a. Example 1
    b. Example 2

  9. Exercise!

Client

1. Someone requests or gives information

This person is the client.

Me

You

Request or gives info

The internet

(Client)

Server

2. A response (or lack thereof) or acknowledgement is given back to the original person.

This person would be the server in this scenario.

Me

You

Response to request

Air between us

(Server)

Where Are We?

  1. What We're Covering

  2. Assumptions
  3. Why is this important?
  4. HTTP is like communication, let's communicate!

  5. Difference between the client (requester) and server (responder)

  6. Explain the types (methods) of a request

  7. Explain the types (statuses) of a response
  8. Examples
    a. Example 1
    b. Example 2

  9. Exercise!

Types of Request (Client)

You can request (and give) information a few different ways.

Please note that this is done on the client side.

GET

Asking for information from the server.

 

 

people: asking a question

computers: asking for google.com

POST

Giving information to a server, new or existing.

 

 

people: Telling other people that you have animals.

computers: logging in, posting on a platform

Types of Request (Client)

A few other methods are (We're not going to go into these in depth)

PUT

Updating already existing information on the server.

 

people: giving more information about an existing thing
ie. giving people your phone number

computers: updating existing information to a user

DELETE

Deleting Information

 

people: forget about this!

computers: remove this information now!

NOTE for Exercise

GET

POST

We're only going to focus on the following two request types in the exercise.

Response Needed!

Now that we've asked for something we need to get a response.

Where Are We?

  1. What We're Covering

  2. Assumptions
  3. Why is this important?
  4. HTTP is like communication, let's communicate!

  5. Difference between the client (requester) and server (responder)

  6. Explain the types (methods) of a request
  7. Explain the types (statuses) of a response

  8. Examples
    a. Example 1
    b. Example 2

  9. Exercise!

Response Types (Server)

200 (up to 299) - Success

Everything is okay! The Server has fulfilled the request (any type)

 

This is the request you want to see the most.

300 (up to 399) - Redirection

Sending this request somewhere else. The Server is redirecting the response to a more appropriate place where it can be fulfilled.

Response Types (Server)

400 (up to 499) - Client Error

Server can't find what you're looking for (Client's error).
For Example a blog post that can't be found.


This request could also tell a client that it doesn't have permission to do the action its' trying to do on the server. 

500 (up to 599) - Server Error

Server error, For example if there's a weird syntax error on the server (computer). Also this would be like if someone is asking something that you know about but is asking it to you in Greek.

Where Are We?

  1. What We're Covering

  2. Talk about how HTTP is like talking
  3. Difference between the client (requesting) and server (responding)
  4. Explain the types (methods) of a request
  5. Explain the types (statuses) of a response
  6. Examples
    a. Example 1
    b. Example 2

  7. Exercise!

Get Data Example

Me

You

Do you have cats?

1. Ask if I have cats.

Air between us

Get Data Example

Me

You

2. I'll respond to tell you that I do have cats

I have three cute cats

Air between us

Get Data Example

Server

This will be sent with a token to show that we can trust the client (I'll cover that later).

The Internet

Client

Get Data Example

Server

Client

Status 200

You can see the website!

If the token is correct, we'll give the information.

The Internet

Where Are We?

  1. What We're Covering

  2. Talk about how HTTP is like talking

  3. Difference between the client (requesting) and server (responding)
  4. Explain the types (methods) of a request
  5. Explain the types (statuses) of a response
  6. Examples
    a. Example 1
    b. Example 2

  7. Exercise!

Post Data Example

Me

You

My dog is named Spot

1. Tell me you have dog named Spot

Air between us

Post Data Example

Me

You

2. I'll respond to tell you that I understand that you have a dog named spot

Thanks! I bet he's cute!

Note:

I'll only remember if I trust this person, otherwise I'll throw this information away.

Air between us

Post Data Example

Server

POST dog picture to twitter

Text

The Internet

Client

Post Data Example

Server

Status 204

The server responds with your post being successful.

The Internet

Client

Where Are We?

  1. What We're Covering

  2. Talk about how HTTP is like talking

  3. Difference between the client (requesting) and server (responding)
  4. Explain the types (methods) of a request
  5. Explain the types (statuses) of a response
  6. Examples
    a. Example 1
    b. Example 2

  7. Exercise!

Think Pair Share!

1. Pair up!
2. One of you will be the server and the other will be the client.
3. Given act out your scenario decide the following:

a. Which is the request, Which is the response?

b. what kind of HTTP request is the client using?
c. What kind of response did the server use?

Conclusion

Lesson Objective:

End of the lesson participants should be able to identify HTTP requests.
 

Recap

We've identified the different HTTP request and response types, and hopefully we understand them a bit better. 

 

It's really not that different than the way we speak to each other!

Thank you for listening!

Marshmallow

Ghost

Gambit

Questions?

Please let me know how I can improve.

Nait BMI presentation number 2, 15 minutes.

By Daniel Mouris

Nait BMI presentation number 2, 15 minutes.

  • 584