Comp 1017 - Day 1
Web Design Fundamentals I

Slides: https://slides.com/danielmouris/comp1017-week1-day1

Where Are We?

  1. What We're Covering

  2. Welcome
  3. Why are you here
  4. What I expect from you
  5. What you can expect from me

  6. Mental Health and support

  7. What you're going to learn

Where Are We?

  1. What We're Covering

  2. Assumptions

  3. What's a RESTful API? Why use it?

  4. Examples
    a. GET data (asking for data from the server)
    b. POST data (giving the data to the server to save)

What You Should Know

You should know the following:

  • Basics of HTTP 
    • Get
    • Post
    • Put
    • Update
    • Delete
  • JSON
  • Domain (www.github.com)
  • Endpoint (anything after the domain)

Where Are We?

  1. What We're Covering

  2. Assumptions
  3. What's a RESTful API? Why use it?

  4. Examples
    a. GET data (asking for data from the server)
    b. POST data (giving the data to the server to save)

What is a RESTful API?

Stands for the following:

REpresentational
State
Transfer

 

Application
Programming
Interface

What is a RESTful API?

It's a way to ask for, modify, create , and delete data (CRUD operations) on another computer or server over the web.

It's also a way that you can trigger an action on a server (such as what anyone here uses Python for) and getting a result.

You can think of a RESTful API as the way we share information when we speak aloud to each other.

Why use it?

Allows a unification of method to call the backend.


- Server to Server (packages: requests, urllib3)
- Server to Mobile App (Android, Ios, Flutter)

- Server to Front End (React, Angular, Vue.js)


Almost all major companies use it, and it's the easiest way to communicate.

- Spotify API
- Google Maps and all others

- Hackernews API

Dan, I'm Lost

Let's see some examples to explain futher

Where Are We?

  1. What We're Covering

  2. Assumptions
  3. What's a RESTful API? Why use it?

  4. Examples
                                                                     

a. GET data (asking for data from the server)
 

b. POST data (giving the data to the server to save)

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

Note:

I'll only tell you that I have three cats if I trust you. Otherwise I won't tell you.

Air between us

Get Data Example

Server

Serving API

- Mobile App

- Other Server

- Front End

GET /cats/

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

The Internet

Get Data Example

Server

Serving API

- Mobile App

- Other Server

- Front End

Status 200
Body: Cat Names

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

The Internet

Where Are We?

  1. What We're Covering

  2. Assumptions
  3. What's a RESTful API?

  4. Examples
                                                                     

a. GET data (asking for data from the server)
 

b. POST data (giving the data to the server to save)

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

Serving API

- Mobile App

- Other Server

- Front End

POST /dogs/

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

The Internet

Body: {'name': 'Spot'}

Post Data Example

Server

Serving API

- Mobile App

- Other Server

- Front End

Status 204

If the token is correct, we'll confirm that we have stored this information.

The Internet

Conclusion

RESTful APIs are way that computers communicate.

 

 

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

Thank you for listening!

Here's my kitties from the example.

Marshmallow

Ghost

Gambit

Questions?

Comp1017 - Week 1 Day 1

By Daniel Mouris

Comp1017 - Week 1 Day 1

Day one for the course comp1017 at nait.

  • 611