Commit cb292b82 authored by George Adrian Stoica's avatar George Adrian Stoica
Browse files

add slides lecture 17

parent b431f393
Pipeline #88500 passed with stage
in 1 minute and 59 seconds
= REST APIs
:customcss: slides.css
:icons: font
:includedir: revealjs/includes/
:LECTURE_TOPIC: REST APIs
:LECTURE_NO: 17th Lecture
include::{includedir}header.adoc[]
[.smaller-80][.center-paragraph]
IT1901 Fall 2020 - {LECTURE_NO}
[.smaller-80]
== Overview
- REST APIs
** HTTP requests
** Methods
** APIs
** REST Recap
== HTTP requests
- **H**yper**t**ext **T**ransfer **P**rotocol (HTTP)
- clients (e.g. browser) send requests
- servers (web site / service) send responses
== HTTP Request message
- a request line `GET / HTTP/1.1`
- request headers - `User-Agent`, `Accept`, `Content-Type` etc.
- an empty line (containing only a `carriage return` and a `line feed`)
- an optional message body
== HTTP Methods
- HTTP specification defines `methods` to indicate what action is expected from the server
** GET, HEAD, OPTIONS
** POST, PUT, PATCH
** DELETE
== APIs
- **A**pplication **P**rogramming **I**nterface
- "Glue" that makes possible different pieces of software to interoperate
- It is meant to be machine readable / usable
- APIs are everywhere - at different levels - software libraries, operating system, applications, web services etc.
== APIs (2)
- typically a set of calls or requests, expected call format, expected response format, data structures
- separate the implementation from the interface
- allow programs in one language to use functionality written in some other language
- cater to modular software
[background-color = "#124990"]
[color = "#fff6d5"]
== REST
[.smaller-80]
== REST
- **RE**presentational **S**tate **T**ransfer (REST)
- architectural style involving use of Web Services
- set of constraints are applied
** client server
** statelessness (no client context is stored on the server side)
** cacheability (responses state if they can be cached or not)
** uniform interface
** layered system (adding layers like proxy or load balancer)
== REST (cont.)
- Web services that implement REST are called RESTful APIs
- a base URI, example: https://gitlab.stud.idi.ntnu.no/api/v4
- set of exposed web resources
- standard HTTP methods (e.g., GET, POST, PUT, PATCH and DELETE);
- data formats for requests and responses (json, xml, etc)
== !
image::../images/lecture12/rtodo.png[canvas, size=contain]
== Security considerations
- CORS (Cross-Origin Resource Sharing)
** headers `Access-Control-Allow-Origin`
- Authentication (Basic Auth, OAuth etc)
- HTTPS (HTTP over TLS)
[background-color = "#124990"]
[color = "#fff6d5"]
== Summary
include::{includedir}footer.adoc[]
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment