Slides: https://slides.com/danielmouris/comp1017-week1-day1
What you can expect from me
Mental Health and support
What you're going to learn
What We're Covering
What's a RESTful API? Why use it?
Examples
a. GET data (asking for data from the server)
b. POST data (giving the data to the server to save)
You should know the following:
What We're Covering
Examples
a. GET data (asking for data from the server)
b. POST data (giving the data to the server to save)
Stands for the following:
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.
- Server to Server (packages: requests, urllib3)
- Server to Mobile App (Android, Ios, Flutter)
- Server to Front End (React, Angular, Vue.js)
- Spotify API
- Google Maps and all others
- Hackernews API
What We're Covering
What's a RESTful API? Why use it?
b. POST data (giving the data to the server to save)
Do you have cats?
1. Ask if I have cats.
Air between us
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
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
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
What We're Covering
What's a RESTful API?
a. GET data (asking for data from the server)
My dog is named Spot
1. Tell me you have dog named Spot
Air between us
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
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'}
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
Marshmallow
Ghost
Gambit